How do I convert german dates to MySQL standard dates?

Posted by Kebman on Stack Overflow See other posts from Stack Overflow or by Kebman
Published on 2012-10-30T10:38:56Z Indexed on 2012/10/30 11:02 UTC
Read the original article Hit count: 131

Filed under:
|

I'm importing a CSV file with dotted german dates into a MySQL database. I want the dates in the CSV to automatically be formatted correctly to the correct data type fields used by MySQL.

I'm using Sequel Pro for the import. I gather I'm supposed to use the STR_TO_DATE function, but I just can't wrap my head around how to use add value or expression.

German date

Here are the dates in the CSV file:

DD.MM.YYYY e.g.: 28.01.1978

MySQL date

Here is what I want to end up with in the database:

YYYY-MM-DD
e.g.: 1978-01-28

Any ideas?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about date