Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert a String to Date format 1

Status
Not open for further replies.

icarus5000

Technical User
May 15, 2003
16
US
I'm trying to convert a string in the format "2002-03-04 00:00:00.00" to a Date format.

I have tried

CDate(val(Mid({Query.Edate},6,2)), val(Mid({Query.Edate},9,2)), val(left({Query.Edate},4)))

but get the error "A month number must be between 1 and 12"

Thanks in advance.

 
Try this:

CDate(val(left({Query.Edate},4)),val(Mid({Query.Edate},6,2)), val(Mid({Query.Edate},9,2)))

-LB
 
Easier to just use :

DTStoDateTime("2002-03-04 00:00:00.00")



Reebo
Scotland (Sunny with a Smile)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top