note 62615 deleted from function.date by derick
| From: | derick@php.net | Date: | Sun, 11 Jun 2006 11:44:22 +0000 |
| Subject: | note 62615 deleted from function.date by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-114256@lists.php.net to get a copy of this message | ||
Note Submitter: james at bandit dot co dot nz
----
I really needed a simple function to tell me how many days had passed since a certain date. The
closest function I found to do this was Brian W. Spolarich's function to check business days
since a date. Thanks.
The below code will tell you how many days have passed since 2006-01-01.
<?php
$date1 = mktime(0,0,0,1,1,2006);
$date2 = mktime(0,0,0,date('m'),date('d'),date('Y'));
$total_days = 0;
while($date1 < $date2) { $total_days++; $date1 += 86400; }
echo $total_days;
?>
Cheers