Jump to content

DATE_FORMAT(date, '%d-%m-%Y') ASC not working


runnerjp

Recommended Posts

23/05/2010  10,000m  Track  BMAF 10k - Oxford  Set a PB 

15/05/2010  Other  Road  BMAF Road Relays - Sutton Park, Birmingham  Get in the team! 

06/06/2010  10,000m  Road  10km Road Championship - Bispham, Blackpool  Set a PB! 

 

 

Is how its showing it... im using a query  $getthreads ="Select * from races ORDER BY DATE_FORMAT(date, '%d-%m-%Y') ASC";

 

what am i doing wrong??

Link to comment
https://forums.phpfreaks.com/topic/195305-date_formatdate-d-m-y-asc-not-working/
Share on other sites

Per your other thread where someone explained why you can only compare dates that have a YYYY-MM-DD (or similar left to right, most significant to least significant, y,m,d field order), you can only sort or order dates that have that format for the same reason (sorting and ordering involves comparisons.)

 

If your date column is a mysql DATE or DATETIME data type, you can use it in an ORDER BY term directly.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.