Page 1 of 1

Date and time format transposition error in CSV imports

PostPosted: Sat Nov 13, 2010 8:28 am
by westwood
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.

Re: Date and time format transposition error in CSV imports

PostPosted: Wed Nov 17, 2010 10:42 am
by shannah
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];