Change Time Format In Mysql Query Order By
i am working on project where user have database with date stored in normal format 8 March 2013 and i want to sort the output with date .. but not getting right output bcos time st
Solution 1:
since it is not a date, use STR_TO_DATE
to convert string to date
SELECT*FROM imdb
WHEREyear='2012'ORDERBY STR_TO_DATE(`date`, '%e %M %Y') DESC
LIMIT 20
Solution 2:
Try this::
SELECT*FROM imdb WHEREyear='2012'ORDERBYDATE(`date`) DESC LIMIT 20
Post a Comment for "Change Time Format In Mysql Query Order By"