note 78266 deleted from function.mktime by felipe
| From: | felipe@php.net | Date: | Sun, 06 Jan 2008 12:07:56 +0000 |
| Subject: | note 78266 deleted from function.mktime by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134861@lists.php.net to get a copy of this message | ||
Note Submitter: carloseduardopauluk at gmail dot com
----
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.