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
28/03/2011 12:11: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:
01505252
Views:
58
>Hi, all
> i want to string to datatime in vb.net , anyone know?
> if the current time ,i know, but if people entry, how can i do......
> And i need converted and use isdate to check........ thx
>
>
>
> Maskedate.Text = Convert.ToDateTime(Now).ToString("dd/MM/yyyy")
>
>
C#
   string entered = "01/11/2011";
   DateTime dateEntered;
   DateTime.TryParse(entered, out dateEntered);
VB.NET
Dim entered As String = "01/11/2011"
Dim dateEntered As DateTime
DateTime.TryParse(entered, dateEntered)
Actually, you will probably want to use the TryParseExact. You'll need to adjust the CultureInfo string, and possibly DateTimeStyles.
Dim entered As String = "01/11/2011"
Dim dateEntered As DateTime
DateTime.TryParseExact(entered, "dd/MM/yyyy", new CultureInfo("en-us"), DateTimeStyles.None, dateEntered)
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform