lynxus Posted February 8, 2011 Share Posted February 8, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/227064-check-if-a-date-is-near-todays-date/ Share on other sites More sharing options...
Maq Posted February 8, 2011 Share Posted February 8, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/227064-check-if-a-date-is-near-todays-date/#findComment-1171447 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.