Jump to content

mysql sorting by date


arbitter

Recommended Posts

Then use a DATE data type for the field, and just concatenate the form values in the proper order, YYYY-MM-DD. It wouldn't be a bad idea to validate the date with checkdate at the same time you validate the rest of the form data to prevent invalid dates from ending up in the table with values of 0000-00-00. Probably the best way to handle user input for dates is with a jQuery datepicker, and add <select> fields for the year, month and day in a <noscript> block, if you want to give that  shot.

 

Do you have misformatted data already in the table that you need to convert as well, or is this a new table?

Link to comment
Share on other sites

It seems to work! I only did the checkdate() though, no jQuery stuff.

 

And it's a new table, so no problems! The dates are so confusing, in america it's mostly mm/dd/yyyy, where I live it's dd/mm/yyyy, and now yyyy/mm/dd :P

 

It wasn't that much adjusting from the script I had, luckily!

 

Thanks a bunch!

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.