Jump to content


How do I work out a past date in PHP mySQL

  • Please log in to reply
1 reply to this topic

#1 mel_bagley

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 03 April 2006 - 01:43 PM

Hi All,

I've got a mySQL table with the following fields:

id, name, expiryDate

The expiry date is in the format dd/mm/yyyy and I would like to show only the dates newer than those in the db, for example

2, balloon, 05/03/2006
3, brick, 12/04/2006

today's date = 03/04/2006 phpdate = (2006-04-03 00:00:00)

What would I need to be able to cycle through the table and return the results but leaves out the past results e.g. balloon.

Many thanks in advance.

Kind Regards


#2 Barand

  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 03 April 2006 - 11:43 PM

MySQL gives you DATE and DATETIME column type and dozens of functions to use with them. Why igmore them invent your own type?

Store dates in a database to be functional, not to look pretty. You can format them any way you want when you query the table or output the results.
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received


|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users