函数str_to_date的日期时间值不正确 [英] Incorrect datetime value for function str_to_date
本文介绍了函数str_to_date的日期时间值不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我看不出这是怎么回事:
I can't see what is wrong with this:
mysql> select str_to_date('3/8/2010 12:31:00 AM', '%c/%e/%Y %k:%i:%s %p');
+-------------------------------------------------------------+
| str_to_date('3/8/2010 12:31:00 AM', '%c/%e/%Y %k:%i:%s %p') |
+-------------------------------------------------------------+
| NULL |
+-------------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)
mysql> show warnings;
+-------+------+---------------------------------------------------------------------------+
| Level | Code | Message |
+-------+------+---------------------------------------------------------------------------+
| Error | 1411 | Incorrect datetime value: '3/8/2010 12:31:00 AM' for function str_to_date |
+-------+------+---------------------------------------------------------------------------+
1 row in set (0.00 sec)
推荐答案
%k:%i:%s %p
%k
是24小时制,不适用于%p
(AM/PM).使用%l
.
%k
is 24-hour clock, doesn't work with %p
(AM/PM). Use %l
.
这篇关于函数str_to_date的日期时间值不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文