ParseExact() basically lets you specify the date/time format to expect when
parsing the string value.
For example, DateTime.ParseE xact ("2004/11/22", "yyyy/MM/dd", null) will get
you a DateTime value with correct date value interpretations . And
DateTime.ParseE xact ("2004/11/22", "yyyy/MM/dd", null).ToString
("MM/dd/yyyy") returns the value in the specified format - "11/22/2004".
Hope this is what you are looking for.
"David Gacek" <so*****@hotmai l.com> wrote in message
news:e1******** ******@TK2MSFTN GP09.phx.gbl...
DateTime.ParseE xac can i use that in any time zone ? and how can i use it to
return the date in mmddyyyy format Month/Day/Year ?
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:O6******** ******@tk2msftn gp13.phx.gbl...
Shiva,
How about DateTime.ParseE xact() ?
That you can use with your sample:
When it is a field from a textbox, than you have to be absolute sure that
your program only is used in a USA datetime format zone, by instance for
Canada that is not sure.
When it is in a document or webpage when you are 100% sure that it is
returned from the zone above.
I hope this helps?
Cor
"Shiva" <sh******@onlin e.excite.com>
How about DateTime.ParseE xact() ?
"David Gacek" <so*****@hotmai l.com> wrote in message
news:uT******** ******@TK2MSFTN GP14.phx.gbl...
I've tried several different ways all with the same reults. Invalid date
Dim ddate As String
ddate = "11/22/2004"
Dim TryToConvert As Date = Date.Parse(ddat e)
Dim TryToConvert2 As Date = Convert.ToDateT ime(ddate)
MsgBox(CDate(dd ate) & TryToConvert & " " & TryToConvert2)