Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Anyone know how to convert string to datetime in vb.net
Message
 
To
30/03/2011 08:29:15
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows XP
Database:
Jet/Access Engine
Miscellaneous
Thread ID:
01505223
Message ID:
01505570
Views:
40
in my code I have
Public dateFormat  as string = "dd/MMM/yy"
3 M's not 2. That forces the user to enter 13/dec/11. There is no ambiguity there.


>sorry, i try your code , but it always return false........ eg(13/12/2011 or 12/13/2011)
>how can i do to check date ?
>
>
>Imports System.Threading
>Imports System.Globalization
>
>Public dateFormat As String = "dd/MM/yy"
>
>    Function checkDate(ByVal c As String) As Boolean
>        Dim d As Date
>        Return Date.TryParseExact(c, dateFormat, CultureInfo.CurrentCulture, DateTimeStyles.AssumeLocal, d)
>    End Function
>

If things have the tendency to go your way, do not worry. It won't last. Jules Renard.
Previous
Reply
Map
View

Click here to load this message in the networking platform