Jump to content

How do I work out a past date in PHP mySQL


mel_bagley

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
Link to comment
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.
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.