php - MySQL Select by (Varchar) Time -
i'm managing date , time in database. in backend/phpmyadmin, column type varchar.
it old , and not correctly made system, it's huge , changing column type date or integer cost lot of time.
my question is: how select ordering time_column in 00:00 format (g:i)?
it looks (works fine problem time lower 10 h 9:00, 8:00)
mysql_query("select * l01vs_database order time asc"); i tried
mysql_query("select * l01vs_database order str_to_date(time,'%g:%i') asc"); but not ever sure if correct.
i think using wrong syntax variables. using '%g:%i', shouldn't '%h:%i'?
"select * l01vs_database order str_to_date(time,'%h:%i') asc" if have twelve hour format, can use '%h'. take @ page more information: http://www.w3cyberlearnings.com/mysql_str_to_date
Comments
Post a Comment