Does mysql understand correctly 'YYYY-MM-DDThh:mm:ss' format for dateTime type?
I have a few date fields which comes from xml (with type xsd:dateTime 'YYYY-MM-DDThh:mm:ss' format). Then I need to save these field into DB (mysql dateTime format is 'YYYY-MM-DD hh:mm:ss' ) Should I convert xml`s date format to mysq date format ? Or can I just insert these fields into the DB without converting?
Does mysql understand correctly ‘YYYY-MM-DDThh:mm:ss’ format for dateTime type? I have a few date
Share
Yes, it does:
mysql> SELECT CAST('2010-12-30T01:02:03' AS datetime); +-----------------------------------------+ | CAST('2010-12-30T01:02:03' AS datetime) | +-----------------------------------------+ | 2010-12-30 01:02:03 | +-----------------------------------------+ 1 row in set (0.08 sec) mysql> SELECT CAST('2010-12-30 01:02:03' AS datetime); +-----------------------------------------+ | CAST('2010-12-30 01:02:03' AS datetime) | +-----------------------------------------+ | 2010-12-30 01:02:03 | +-----------------------------------------+ 1 row in set (0.00 sec)