ID:               43113
 Updated by:       [EMAIL PROTECTED]
 Reported By:      anderson at berkeleypim dot com dot br
-Status:           Open
+Status:           Bogus
 Bug Type:         *General Issues
 Operating System: linux
 PHP Version:      5.2.4
 New Comment:

We are happy to tell you that you just discovered Daylight Savings
Time. For more information see:
http://webexhibits.org/daylightsaving/b.html
Instead of using mktime/date consider using gmmktime and gmdate which
do
not suffer from DST.

.


Previous Comments:
------------------------------------------------------------------------

[2007-10-27 00:00:41] anderson at berkeleypim dot com dot br

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 this bug report at http://bugs.php.net/?id=43113&edit=1

Reply via email to