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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert string to date in Update Query 1

Status
Not open for further replies.

LyndonOHRC

Programmer
Sep 8, 2005
603
US
I'm needing to populate a new field with the date string stored in a text field. Past developer buried a key date in a text string with other data.

The date data is in cloumns 2-9 for the filename field. The string format is "*YYYYMMDD*********" and is zero filled so this should work if I just knew what functions to use and how to use them....

Thanks in advance.

Code:
UPDATE raceday  
SET racedate = CDate(Mid(FileName6,2) &'/'& Mid(FileName,8,2) &'/'& Mid(FileName,2,4)) WHERE 1=1

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 
What about this ?
UPDATE raceday
SET racedate = DateSerial(Mid(FileName,2,4),Mid(FileName,6,2),Mid(FileName,8,2))

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Perfect! Thank you very much.

Lyndon

---People Remember about 10% of what you say ---They never forget how you made them feel. Covey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top