Link to home
Start Free TrialLog in
Avatar of RichardRiga
RichardRiga

asked on

How do I convert this particular string to datetime using VB.net

Given the string, "Wed, 12 May 2010 13:05:04 -0400 (EDT)", how can I convert it to a long datetime format (mm/dd/yyyy hh:mm:ss xM)?

Thanks!
Avatar of Tom Beck
Tom Beck
Flag of United States of America image

Not sure what you wanted at the end with "xM".

Dim dt2 As DateTime = New DateTime(2010, 5, 12, 13, 5, 4)
MsgBox(dt2.ToString("mm/dd/yyyy hh:mm:ss"))
Avatar of RichardRiga
RichardRiga

ASKER

xM was AM/PM.  Is there a better way than having to parse out the string and converting May to 5, etc?
ASKER CERTIFIED SOLUTION
Avatar of Tom Beck
Tom Beck
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks so much, exactly what i needed.  Good explanation