Jump to content

[SOLVED] Help with sorting by dates formated like 01/05/2009


Presto-X

Recommended Posts

Hello everyone,

 

I have a large database with a list of dates, the system preformats the dates and saves them in this format 01/05/2009. but when I use mysql to sort by date it is not turning out like I want.

 

This is how my dates are getting displayed:

01/05/2009

03/24/2009

09/15/2008

10/15/2008

11/03/2008

 

This is the line I'm using:

$query_upcourses = "SELECT * FROM jos_courses_dates ORDER BY course_start_date ASC";

 

If you need any other information let me know.

Link to comment
Share on other sites

Thanks for the reply Mchl, I updated my date rows from varchar to date. I'm using a javascript date selector, found here: http://www.dynamicdrive.com/dynamicindex7/jasoncalendar.htm they give you the following date formats, what format should I use when saving to my database?

 

YYYYMMDD

YYYY-MM-DD *

YYYY-DD-MM *

YYYY/MM/DD *

YYYY/DD/MM *

YYYY-DD-MON *  **

YYYY-MON-DD *  **

MM-DD-YYYY *

DD-MM-YYYY *

MM/DD/YYYY *

DD/MM/YYYY *

DD-MON-YYYY *  **

MON-DD-YYYY *  **

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.