From: vidya at webwisesage dot com
Operating system: Unix
PHP version: 4.3.8
PHP Bug Type: Date/time related
Bug description: Date function returns incorrect results
Description:
------------
I wrote a little program below that shows the problem. This simply adds 1
day to the date and prints the date.
At Oct 31st, 2004, it prints 2004-10-31 TWICE. In other words, the date
function is returning an incorrect result.
Reproduce code:
---------------
<?php
define("ONEDAY",86400); // seconds in a day
$startdate = "20041001";
$timestamp = strtotime($startdate);
for($i=0; $i<95; $i++):
$timestamp = $timestamp + ONEDAY;
$workingdate = date("Y-m-d",$timestamp);
echo("NEXT DAY IS $workingdate <br>");
endfor;
?>
Expected result:
----------------
All dates from 10-02-2004 until 01-02-2005 printed one after the other in
sequence.
Actual result:
--------------
NEXT DAY IS 2004-10-26
NEXT DAY IS 2004-10-27
NEXT DAY IS 2004-10-28
NEXT DAY IS 2004-10-29
NEXT DAY IS 2004-10-30
NEXT DAY IS 2004-10-31
NEXT DAY IS 2004-10-31
NEXT DAY IS 2004-11-01
NEXT DAY IS 2004-11-02
NEXT DAY IS 2004-11-03
NEXT DAY IS 2004-11-04
NEXT DAY IS 2004-11-05
--
Edit bug report at http://bugs.php.net/?id=30357&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30357&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30357&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30357&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30357&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30357&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30357&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30357&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30357&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30357&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30357&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30357&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30357&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30357&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30357&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30357&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30357&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30357&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30357&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30357&r=mysqlcfg