如何使用脚本将此日期格式转换为 mysql
How can I convert this date format to mysql using script
我有这种格式的日期:Jan 6 2015 19:28:24 GMT
并且想转换成类似 mysql 的格式。有没有一种方法可以在 mysql 中执行此操作,因为我的 table 中已经有数据作为字符串。
使用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)
我有这种格式的日期:Jan 6 2015 19:28:24 GMT
并且想转换成类似 mysql 的格式。有没有一种方法可以在 mysql 中执行此操作,因为我的 table 中已经有数据作为字符串。
使用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)