From: [EMAIL PROTECTED]
Operating system: Linux merlin 2.4.6
PHP version: 4.1.0
PHP Bug Type: Date/time related
Bug description: 3rd Sunday of every March (has 25 hours?)
While trying to get a list of dates between any two given dates by adding
86400 (secs per day) to each consecutive datetime, I discovered that adding
86400 (secs per day) to the 3rd Sunday of March (in any year) results in a
datetime which is interpreted by the date() function as 23:00 hrs on the
same Sunday - rather then 00:00 hr on the following day, as it should be.
There also seems to be a similar effect in reverse some time in October.
Have a look at the result of the following script, using any range of dates
in $datetime_temp and $datetime_end.
<?php
$datetime_temp = strtotime("2002-1-1");
$datetime_end = strtotime("2002-12-31");
echo "start: ".date("Y-n-j H:i:s", $datetime_temp);
echo " end: ".date("Y-n-j H:i:s", $datetime_end)."<br/>\n";
$datetimes = array();
while($datetime_temp <= $datetime_end) {
$datetimes[] = $datetime_temp;
echo date("Y-n-j H:i:s", $datetime_temp)."<br/>\n";
$datetime_temp += 86400;
}
?>
Partial output:
...
2002-3-15 00:00:00
2002-3-16 00:00:00
2002-3-17 00:00:00
2002-3-17 23:00:00
2002-3-18 23:00:00
2002-3-19 23:00:00
...
2002-10-3 23:00:00
2002-10-4 23:00:00
2002-10-5 23:00:00
2002-10-7 00:00:00
2002-10-8 00:00:00
2002-10-9 00:00:00
...
What's happening?
Is there another/better way for me to get my list of dates?
--
Edit bug report at: http://bugs.php.net/?id=14259&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]