i need to send mail 1 month before expirydate stored in database to a client..till now i can just compare the dates by converting them using strtotime.is there anyways to find out many days are left till expirydate.
Comparing Dates
Collapse
X
-
Hi bips
here it is what I understood you want to do
Code://considering this date is being fetch from db and was stored in this format $date = "2008-07-15 22:15:58"; $date1 = substr($date, 0, 11); $date2 = date("Y-m-d"); // current date $difference = abs(strtotime($date2) - strtotime($date1)); $days = round(((($difference/60)/60)/24), 0); //remaining days
-
Originally posted by hsriatHow are you doing that, if you can show some code?
Code:$chexpiraton = strtotime($expiration); $today = date("Y-m-d"); $chtoday = strtotime($today); $diff = $chexpiraton - $chtoday; $noday = $diff / (24*60*60);
Comment
-
Originally posted by bips2005thank you i finally made the code worked
Code:$chexpiraton = strtotime($expiration); $today = date("Y-m-d"); $chtoday = strtotime($today); $diff = $chexpiraton - $chtoday; $noday = $diff / (24*60*60);
Comment
-
Originally posted by hsriatWhat format is $expiration?.. If its simple UNIX time stamp, then subtract 30*24*60*60 from it and compare it with 'sec' index of gettimeofday array.Comment
Comment