note 45568 rejected from function.date by aidan
| From: | aidan@php.net | Date: | Sat, 11 Sep 2004 07:35:53 +0000 |
| Subject: | note 45568 rejected from function.date by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-76440@lists.php.net to get a copy of this message | ||
Note Submitter: phpmonkey at badpenguins dot com
----
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?