Question

How can I order in MySQL a column with date values like this "06:21, 28 February 2014"?

Était-ce utile?

La solution

Use STR_TO_DATE() to convert it into a date first and then sort by it:

SELECT STR_TO_DATE(datecol, "%H:%i, %d %M %Y") AS newdate
-- ...
ORDER BY newdate DESC
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top