Edit report at http://bugs.php.net/bug.php?id=52340&edit=1

 ID:               52340
 User updated by:  andrea dot romagnoli at getlocal dot it
 Reported by:      andrea dot romagnoli at getlocal dot it
 Summary:          strtotime conversion error
 Status:           Bogus
 Type:             Bug
 Package:          Date/time related
 Operating System: Linux
 PHP Version:      5.3.2

 New Comment:

Yes, but if I check the difference day by day from 22 march to 29 march
is ever of 24H, why the daylight saving is show to me only if I subtract
a week?


Previous Comments:
------------------------------------------------------------------------
[2010-07-15 10:58:18] sala...@php.net

The actual number of seconds between those two date/times is expected.
This is 

because it crosses a Daylight Savings boundary (at
2010-03-28T01:00:00+0000). 

Since the clocks went forward by an hour at that time, the number of
seconds 

between the dates reflects that resulting in a "missing" hour.



For more information see
http://en.wikipedia.org/wiki/Daylight_saving_time

------------------------------------------------------------------------
[2010-07-15 01:50:18] andrea dot romagnoli at getlocal dot it

Description:
------------
The result of subtraction between result of strtotime("Monday 29 March
2010 06:00:00") and the result of strtotime("Monday 22 March 2010
06:00:00") is not a week, but instead is a week less 2,5 minutes...



Infact a week are 604800 seconds but the result of this subtraction is
601200.



I tried to subtract day per day in the interval and all subtractions are
correct and results every time 86400 seconds.

Test script:
---------------
<?php

error_reporting(E_ALL|E_STRICT);

date_default_timezone_set ('Europe/London');



$dates = array("Monday 15 March 2010 06:00:00", "Monday 22 March 2010
06:00:00",

  "Monday 29 March 2010 06:00:00", "Monday 05 April 2010 06:00:00",
"Monday 12 April 2010 06:00:00", "Monday 19 April 2010 06:00:00");



var_dump($dates);

$datesInt = array();

foreach($dates as $date)

  $datesInt[] = strtotime($date);



$lastDate = $datesInt[0];

for($i = 1; $i < count($datesInt); $i++){

  $tmp = $datesInt[$i]-$lastDate;

  var_dump($tmp);

  $lastDate = $datesInt[$i];

}

?>

Expected result:
----------------
I think that all subtractions should be return 604800 seconds.

Actual result:
--------------
Actually one of subtractions return 601200 instead of 604800 seconds.


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52340&edit=1

Reply via email to