Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

convert string to 24 hour datetime format in mysql

I am new to mysql. I need to insert the string '2014-07-10 13:33:33' into the table column which has datetime datatype.

I gave like this,

 SELECT STR_TO_DATE('2014-07-09 23:30:00', '%Y/%m/%d %h:%m:%s');

But i didn't not give the result. How to do this?

like image 570
thevan Avatar asked Jul 10 '14 11:07

thevan


1 Answers

Minutes is %i, not %m and 24-hour format is %H, not %h:

SELECT STR_TO_DATE('2014-07-09 23:30:00', '%Y-%m-%d %H:%i:%s');
like image 149
Gordon Linoff Avatar answered Nov 16 '22 00:11

Gordon Linoff