开发者

mysql YYYY-MM-DDThh:mm:ss

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?


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)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜