Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Anyone know how to convert string to datetime in vb.net
Message
 
À
29/03/2011 13:13:28
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:
01505409
Vues:
58
Hi Allex,

This is how I solved this, I force my users to enter the month alphabetically.
        Dim cDS As String = DateTimeFormatInfo.CurrentInfo.DateSeparator
        Me.Mask = "##" & cDS & "aaa" & cDS & "##"
For Dutch I use the following validation (at this stage, I only support dutch at this stage)
    Public dateFormat As String = "dd/MMM/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
>Thank for your reply me ,but i have some problem.........
>If the user region setting is Date format (DD/MM/YY) then , eg. (13/02/11)
>
>but if the user region setting is Date format (MM/DD/YY) eg. (13/02/11), will error in isdate function, so how can i do ,
>in isdate function convert the Maskedate.Text to do checking, base user region setting date format?
>
>
>Dim dateEntered As DateTime
>        DateTime.TryParse(Maskedate.Text, dateEntered)
>
> If IsDate(Maskedate.Text) = False Then
>            MsgBox("Error available date !", 48, "Warning")
>            Maskedate.Focus()
>            check = False
>            Exit Sub
>
>

If things have the tendency to go your way, do not worry. It won't last. Jules Renard.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform