Jump to content


newbie date help

  • Please log in to reply
1 reply to this topic

#1 tristeve

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 28 September 2006 - 02:03 PM

Hoping I can get some advice/pointers here. I've inherited a fairly basic MySQL where the date of an event is stored in 3 fields:

day [tinyint(2)] - example: 19
month [varchar(20)] - example: November
year [year(4)] - example: 06

I'm having no problems retrieving all events from the database, but I'd like to somehow sort them in ascending order from today's date.

Thanks in advance,


#2 fenway

  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 28 September 2006 - 02:56 PM


Don't store dates that way...ever.  Use the native DATE / DATETIME column types, since you can extract individual pieces of the date if stored properly.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users