note 45568 added to function.date
| From: | phpmonkey at badpenguins dot com | Date: | Fri, 10 Sep 2004 23:42:52 +0000 |
| Subject: | note 45568 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-76433@lists.php.net to get a copy of this message | ||
Can someone tell me why the following function returns Oct 31st twice?
<?
$start_date = '2004-10-25';
$end_date = '2004-11-01';
$start_ts = strtotime($start_date);
$end_ts = strtotime($end_date);
$mx = 60*60*24;
for($j=$start_ts; $j <= $end_ts; $j += $mx) {
$cur_year = date('Y',$j);
$cur_month = date('F',$j);
$day_str = date('jS',$j);
echo "y: $cur_year m: $cur_month d: $day_str ts: $j<br>";
}
?>
The output looks like:
y: 2004 m: October d: 25th ts: 1098680400
y: 2004 m: October d: 26th ts: 1098766800
y: 2004 m: October d: 27th ts: 1098853200
y: 2004 m: October d: 28th ts: 1098939600
y: 2004 m: October d: 29th ts: 1099026000
y: 2004 m: October d: 30th ts: 1099112400
y: 2004 m: October d: 31st ts: 1099198800
y: 2004 m: October d: 31st ts: 1099285200
Where is that extra October 31st coming from?
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45568
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45568&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45568&report=yes
Search -- http://master.php.net/manage/user-notes.php