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
29/03/2011 13:13:28
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:
01505409
Views:
57
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform