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?

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!

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.