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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.