From: anderson at berkeleypim dot com dot br Operating system: linux PHP version: 5.2.4 PHP Bug Type: *General Issues Bug description: Date problem -
Description: ------------ Problem in ADD day a date Reproduce code: --------------- <? $data_inicio = '2007-10-23'; $data_fim='2007-11-08';$data_fim1='2007-10-23'; $i=0; while ($data_fim1 <= $data_fim) { $i=$i+1; $data_fim1 = soma_dia($data_inicio,$i); echo "<br>".$data_inicio." d=".$data_fim1." i=".$i; } function soma_dia($this_date,$num_days){ $my_time = strtotime ($this_date); //converts date string to UNIX timestamp $timestamp = $my_time + ($num_days * 86400); //calculates # of days passed ($num_days) * # seconds in a day (86400) $return_date = date("Y-m-d",$timestamp); //puts the UNIX timestamp back into string format return $return_date;//exit function and return string } ?> Expected result: ---------------- 2007-10-23 d=2007-10-24 i=1 2007-10-23 d=2007-10-25 i=2 2007-10-23 d=2007-10-26 i=3 2007-10-23 d=2007-10-27 i=4 2007-10-23 d=2007-10-28 i=5 2007-10-23 d=2007-10-29 i=6 2007-10-23 d=2007-10-30 i=7 2007-10-23 d=2007-10-31 i=8 2007-10-23 d=2007-11-01 i=9 2007-10-23 d=2007-11-02 i=10 2007-10-23 d=2007-11-03 i=11 2007-10-23 d=2007-11-04 i=12 *************************** 2007-10-23 d=2007-11-05 i=13 ****** SAME - IS IMPOSSIBLE) 2007-10-23 d=2007-11-06 i=14 2007-10-23 d=2007-11-07 i=15 2007-10-23 d=2007-11-08 i=16 2007-10-23 d=2007-11-09 i=17 2007-10-23 d=2007-11-10 i=18 OK - runing at HOSTGATOR.COM at 21:37 brazil timezone. Actual result: -------------- 2007-10-23 d=2007-10-24 i=1 2007-10-23 d=2007-10-25 i=2 2007-10-23 d=2007-10-26 i=3 2007-10-23 d=2007-10-27 i=4 2007-10-23 d=2007-10-28 i=5 2007-10-23 d=2007-10-29 i=6 2007-10-23 d=2007-10-30 i=7 2007-10-23 d=2007-10-31 i=8 2007-10-23 d=2007-11-01 i=9 2007-10-23 d=2007-11-02 i=10 2007-10-23 d=2007-11-03 i=11 2007-10-23 d=2007-11-04 i=12 *************************** 2007-10-23 d=2007-11-04 i=13 ** SAME - IS IMPOSSIBLE) Look a date 2007-10-23 d=2007-11-05 i=14 2007-10-23 d=2007-11-06 i=15 2007-10-23 d=2007-11-07 i=16 2007-10-23 d=2007-11-08 i=17 2007-10-23 d=2007-11-09 i=18 OK - runing at HOSTGATOR.COM at 21:37 brazil timezone. -- Edit bug report at http://bugs.php.net/?id=43113&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43113&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43113&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43113&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43113&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43113&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43113&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43113&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43113&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43113&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43113&r=support Expected behavior: http://bugs.php.net/fix.php?id=43113&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43113&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43113&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43113&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43113&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43113&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43113&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43113&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43113&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43113&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43113&r=mysqlcfg