Results 1 to 2 of 2
Thread: basic question - order by date
Feb 25, 2010, 15:26 #1
basic question - order by date
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.
Feb 25, 2010, 15:38 #2
- Join Date
- Aug 2000
- Philadephia, PA
- 1 Post(s)
- 0 Thread(s)
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_columnTry Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more