Bug #52340 [Opn->Bgs]: strtotime conversion error
| From: | salathe@php.net | Date: | Thu, 15 Jul 2010 08:58:19 +0000 |
| Subject: | Bug #52340 [Opn->Bgs]: strtotime conversion error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-152423@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52340&edit=1
ID: 52340
Updated by: salathe@php.net
Reported by: andrea dot romagnoli at getlocal dot it
Summary: strtotime conversion error
-Status: Open
+Status: Bogus
Type: Bug
-Package: Calendar related
+Package: Date/time related
Operating System: Linux
PHP Version: 5.3.2
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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