Jump to content

Only display if date is after current date (Date: YYYY - MM - DD)


Recommended Posts



I'm using a script which allows you to click on a calendar to select the date to submit to the database.


The date is submitted like this: 2014-02-08


Is there a really simple way to prevent rows showing if the date is in the past?


Something like this:

if($currentdate < 2014-02-08 || $currentdate == 2014-02-08) {




Thanks very much,


Link to comment
Share on other sites

Check strtotime function.

It converts a date into Unix timestamp.


You can convert both current date and date to  compare in unix timestamp [which is in seconds] and do a <= comparison.

Thanks that's exactly what I need!


Your question isn't very clear, but maybe something like this is what you mean?


SELECT field FROM table WHERE date >= CURDATE()

Thanks to you also I'll use this to actually get the right rows from the db. :)

Link to comment
Share on other sites


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.