简体   繁体   中英

Store ISO String in mysql column of type DATETIME

I have a column of type DATETIME in my table. I want to store there an ISO String, which I need to convert to DATETIME in order to store it.

For this, I did some test: SELECT STR_TO_DATE('2021-01-07T13:35:34.604Z', '%Y-%m-%dT%H:%i:%sZ');

But I get as result: NULL . What am I doing wrong?

This did the job: SELECT CAST('2021-01-07T13:35:34.604Z' AS DATETIME);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM