开发者

Incorrect datetime value for function str_to_date

开发者 https://www.devze.com 2023-02-19 20:10 出处:网络
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\');

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 is 24-hour clock, doesn't work with %p (AM/PM). Use %l.


Try:

mysql> select str_to_date('3/8/2010 12:31:00 AM', '%m/%d/%Y %h:%i:%s %k');
0

精彩评论

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