Date and time format transposition error in CSV imports
Archived from the Xataface Users forum.
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.
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];