Jump to content

Check if a date is NEAR todays date?


lynxus

Recommended Posts

Hi Guys,

 

Need some help :(

 

I have two dates:

Now= 2011-02-08 

Expires= 2011-06-15

 

How can I check if we are getting close to the expire date.

 

For example.

 

Lets say we were 5 days away from 2011-06-15 ( todays date was 2011-06-10 ) for example..

 

How can i tell this? / return 1

 

Ie:

if date is 5 days or less away do ( this )

 

Its s essentially so i can email people when something is due to expire.

 

Many thanks

L

 

 

Link to comment
https://forums.phpfreaks.com/topic/227064-check-if-a-date-is-near-todays-date/
Share on other sites

Add 5 days to 'now' and check to see if it is greater than 'expire'.

 

Check out this tutorial:

http://www.brightcherry.co.uk/scribbles/2009/01/06/php-adding-and-subtracting-dates/

 

You can use logical operators when dates are in strtotime format.

Archived

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.