Let's say:
$termdate = 9/10/11
$addeddate = 8/11/11
$nowdate = 9/23/11
The result is calculated at 13 days diff and $newtermdate will be 09/23/11. That is fine.
However let's say:
$termdate = 12/09/11
$addeddate = 8/11/11
$nowdate = 9/23/11
The result is still calculated at 13 days diff and $newtermdate will be 12/22/11. That is obviously wrong. Any ideas?
PHP Code:$termdate = $row['termdate'];
$addeddate = $row['date'];
$nowdate = date("m/d/y");
$diff = abs(strtotime($nowdate) - strtotime($addeddate));
$years = floor($diff / (365*60*60*24));
$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
$days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
$newtermdate = strtotime('+'.$days.' day', strtotime($termdate));
$newtermdate = date('m/d/y', $newtermdate);



Reply With Quote





Bookmarks