note 40500 added to function.mktime
| From: | joe at pellicer dot org | Date: | Fri, 05 Mar 2004 16:15:40 +0000 |
| Subject: | note 40500 added to function.mktime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-66304@lists.php.net to get a copy of this message | ||
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!
----
Manual Page -- http://www.php.net/manual/en/function.mktime.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40500
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40500&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40500&report=yes
Search -- http://master.php.net/manage/user-notes.php