Date and time format transposition error in CSV imports

A place for users and developers of the Xataface to discuss and receive support.

Date and time format transposition error in CSV imports

Postby westwood » Sat Nov 13, 2010 8:28 am

Hi all.
When I import data containing date-time fields they are imported as yyyy-dd-mm hh:mm:ss with the month and date values transposed. (The field type in the database is DATETIME). The data in the CSV is in the form dd/mm/yyyy hh:mm:ss. I can't find anything relevant in the forum so I guess I've done something stupid. Can anyone help?

Thanks & Regards,
Steve.
westwood
 
Posts: 2
Joined: Wed Nov 10, 2010 1:37 pm

Re: Date and time format transposition error in CSV imports

Postby shannah » Wed Nov 17, 2010 10:42 am

If I were you I'd manually parse the date and put it in a format that mysql likes.
e.g.
Code: Select all
$date = '27/12/1978';
$parts = explode('/', $date);
$date = $parts[2].'-'.$parts[1].'-'.$parts[0];
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 20 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved