Jump to content

Archived

This topic is now archived and is closed to further replies.

mel_bagley

How do I work out a past date in PHP mySQL

Recommended Posts

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

1,chair,09/08/2006
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

Mel

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

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.