Hi,
I am trying to utilize the strtotime function but am getting unexpected results. I created the following function to return the difference between two dates.
function showDateDiff($date1, $date2)
{
$ndate1 = strtotime($date1);
$ndate2 = strtotime($date2);
$date_diff = $ndate2 - $ndate1;
return $date_diff;
}
print showDateDiff("03/22/2006","04/21/2006");
The above code will return 2588400 (seconds in 30 days)
3/22/2006 to 04/21/2006 is exactly 31 days however if you multiply 86400 (seconds in a day) by 30 you get 2592000. I would expect that the two answers should be the same.
Not sure what I am doing wrong.
Thanks,
Jeff