Convert text to date format

G

Guest

How would I convert the text string '2004-01-19-13:15:30' to a date format? I am assuming I would use the cdate function, I am just not sure how it would look. Thanks for your help!
 
J

John Vinson

How would I convert the text string '2004-01-19-13:15:30' to a date format? I am assuming I would use the cdate function, I am just not sure how it would look. Thanks for your help!

Hm. As I feared, the hyphen between the day and the hour messes this
up. This works:

?cdate("2004-01-19 13:15:30")
1/19/2004 1:15:30 PM

So I'd suggest the rather contorted approach below. Assuming that this
string date is in a Text field named sDate, use

CDate(Left([sDate], 10) & " " & Right([sDate], 8))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top