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

Use SQL to modify text from yyyy/mm/dd to dd/mm/yyyy

Status
Not open for further replies.

Rangie

MIS
Aug 7, 2001
8
AU
I have imported data into Access and wish to change the format of a field containing a date in YYYY/MM/DD format to DD/MM/YYYY format. If I set the field to a date type the import fails. Is there a way of using an SQL query that would fix the problem.
 
Can you change the imported file date to be in the format of yyyy-mm-dd or mm/dd/yy which are acceptable date formats to Access. If not then import the date as text into one field and define another field as a type date and run a conversion query to get the text date into a date type field.

Something like.
Update yourtable
Set dateTypeField = (mid(textTypeField,9,2) + "/" + mid(textTypeField,6,2) + "/" + right(textTypeField,4)
 
Thanks, I have had to look at chaning the date format as I have no control over the data export format.
This is what I typed:
UPDATE [Maximizer notes] Set Date field12 = (mid(text field9,9,2) + "/" + mid(text field9,6,2) + "/" + right(text field9,4)
I get a Syntax error in the UPDATE statement that points to Date in "Set Date Field12"
??
 
If this is a field name then get rid of the space.
Set Date field12 =
change to.
Set Datefield12 =
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top