note 40500 deleted from function.mktime by tomsommer
| From: | tomsommer@php.net | Date: | Sat, 06 Mar 2004 23:01:04 +0000 |
| Subject: | note 40500 deleted from function.mktime by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-66365@lists.php.net to get a copy of this message | ||
Note Submitter: joe@pellicer.org
----
Yet another quick and dirty days-between-dates calculator:
<?
// use your favorite date format, just split day, month and year for both dates
// date1 < date2
// date1_day, date1_month, date1_year
// date2_day, date2_month, date2_year
while(mktime(0,0,0,$date1_month,$date1_day,$date1_year) <
mktime(0,0,0,$date2_month,$date2_day,$date2_year)) {
$date1_day ++;
$days ++;
}
?>
Now $days contains the number of days between date1 and date2.
Like I said, quick and dirty!