Yeah just check
Dim sTime as DateTime
StartTime = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss")
When i try on 08/06/2007 it works. But when I change the date to
22/06/2007. (The dates I mentioned is 08-Jun-2007 and 22-Jun-2007)
The exception I get is "Cast from string "06/22/2007 10:27:49" to
type 'Date' is not valid."
Pls advise.
> Local setting shouldn't really matter because you are giving your own
> formatting. Anyway, try this: DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss")
[quoted text clipped - 17 lines]
>
> - Show quoted text -
Göran Andersson - 09 Jun 2007 10:26 GMT
> Yeah just check
>
[quoted text clipped - 6 lines]
> The exception I get is "Cast from string "06/22/2007 10:27:49" to
> type 'Date' is not valid."
The code that you showed can not produce that error message, as you are
not converting a string to a date in that code.
When you parse the string, either specify a culture that uses that date
format, or use DateTime.ParseExact with the same formatting string as
you used to create the string.

Signature
Göran Andersson
_____
http://www.guffa.com