There is many solutions to get the difference between two dates by using the mktime function. But, like posted by PHPCoder, due to the 32-bits nature of timestamps values, there is no mean to use mktime to dates bigger than 2038-01-19T03:14:08+0000Z.
One other solution to get the difference between two dates is to use this function:
function date_dif($iniDate, $endDate) {
$iniDate = explode("-",$iniDate);
$endDate = explode("-",$endDate);
$start_date = gregoriantojd($iniDate[1], $iniDate[2], $iniDate[0]);
$end_date = gregoriantojd($endDate[1], $endDate[2], $endDate[0]);
$dif = $end_date - $start_date;
return $dif;
}
The result is given in days.
Monday, December 17, 2007
The Difference Between Two Dates
POSTED BY
Oriol
AT
6:47 PM