note 73266 added to function.date
| From: | dragon at alimex dot biz | Date: | Thu, 15 Feb 2007 08:30:24 +0000 |
| Subject: | note 73266 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-123402@lists.php.net to get a copy of this message | ||
The function posted by mybenchmarkid down is great, but I would suggest a slight change.
The "$days" line should be without the "+1" at the end:
$days = (strtotime($endDate) - strtotime($startDate)) / 86400;
and the "for" line should be with "<=" instead of "<":
for($i=0; $i<=$days; $i++)
This way you can use a specific endDate or just use today:
$days = (time() - strtotime($startDate)) / 86400;
It will work both ways.
Bobby
----
Server IP: 217.75.128.29
Probable Submitter: 217.174.144.3
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- https://master.php.net/note/edit/73266
Del: integrated -- https://master.php.net/note/delete/73266/integrated
Del: useless -- https://master.php.net/note/delete/73266/useless
Del: bad code -- https://master.php.net/note/delete/73266/bad+code
Del: spam -- https://master.php.net/note/delete/73266/spam
Del: non-english -- https://master.php.net/note/delete/73266/non-english
Del: in docs -- https://master.php.net/note/delete/73266/in+docs
Del: other reasons-- https://master.php.net/note/delete/73266
Reject -- https://master.php.net/note/reject/73266
Search -- https://master.php.net/manage/user-notes.php