I have a mySQL DB and I want to order the query results by date. Do the field need to be unix timestamp or can it just be a date field? And what format must the day be in? ie YYYY-MM-DD etc.
Thanks for any help.
DATE (and DATETIME, TIMESTAMP) are explicit data types in MySQL
If the column is a DATE, DATETIME or TIMESTAMP type, then MySQL knows how to sort by the values in that column
There are many formats MySQL can recognize when it comes to inserting the dates into the database:
But that is not relevant when it comes to sorting, as the values are already there
SELECT ... ORDER BY your_date_column