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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With