Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Anyone know how to convert string to datetime in vb.net
Message
 
À
30/03/2011 08:29:15
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows XP
Database:
Jet/Access Engine
Divers
Thread ID:
01505223
Message ID:
01505570
Vues:
41
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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform