我有这种格式的日期:2015 年 1 月 6 日 19:28:24 GMT
并希望转换为类似 mysql 的格式。有没有一种方法可以在 mysql 中执行此操作,因为我的表中已经有数据作为字符串。
最佳答案
使用str_to_date
功能:
MariaDB [(none)]> select str_to_date('Jan 6 2015 19:28:24 GMT', '%M %d %Y %H:%i:%s');
+-------------------------------------------------------------+
| str_to_date('Jan 6 2015 19:28:24 GMT', '%M %d %Y %H:%i:%s') |
+-------------------------------------------------------------+
| 2015-01-06 19:28:24 |
+-------------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)
关于mysql - 如何使用脚本将此日期格式转换为 mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28175021/