mysql - escap character make date value null -
when use - in date format, works fine. however, returns null if used /
select str_to_date(concat('2017-04-02',' ', sec_to_time('45000')),'%y/%m/%d %h:%i:00 %p') cities;
you can try this:
select date_format(str_to_date(concat('2017-04-02',' ', sec_to_time('45000')),'%y-%m-%d %h:%i:00'), '%y/%m/%d %h:%i:00 %p') cities; you have apply format mask string before change date format. don't have either or pm in original string, have remove %p.
a similar case here: updating date format in mysql
Comments
Post a Comment