Bug #61530 [Com]: DateTimeInterval subtracting wrong on summertime Threshold
Edit report at https://bugs.php.net/bug.php?id=61530&edit=1
ID: 61530
Comment by: jimmyraynor at gmail dot com
Reported by: nicolas dot douillet at gmail dot com
Summary: DateTimeInterval subtracting wrong on summertime
Threshold
Status: Open
Type: Bug
Package: Date/time related
Operating System: Debian / Linux
PHP Version: 5.3.10
Block user comment: N
Private report: N
New Comment:
Ran into this issue with PHP 5.4.17 (cli) (built: Aug 25 2013 02:03:38)
TZ: date.timezone => America/Santiago
Between dates 2013-09-08 and 2014-01-15
Using OS: Mac Os 10.9
Funny fact is that I have three servers doing the same operation and only my mac returns different.
Previous Comments:
------------------------------------------------------------------------
[2012-05-16 23:51:35] kavi at postpro dot net
We can verify on 5.3.3 if that's worth anything. This is a problem, please fix
it.
------------------------------------------------------------------------
[2012-03-27 16:31:41] nicolas dot douillet at gmail dot com
Description:
------------
If you're using a timezone, like Europe/Paris, with summer and winter times, you
will obtain a wrong result when adding and subtracting a time interval on a date
at summertime threshold.
I fixed that issue by making all operations on GMT timezone.
Test script:
---------------
date_default_timezone_set('Europe/Paris');
/*
Get a time just on the threshold
*/
$d = new DateTime("2012-03-25 03:00:00");
echo $d->format(DateTime::RFC2822) . "\n";
/*
Substract one hour
*/
$i = new DateInterval("PT1H");
$d->sub($i);
echo $d->format(DateTime::RFC2822) . "\n";
Expected result:
----------------
Sun, 25 Mar 2012 03:00:00 +0200
Sun, 25 Mar 2012 01:00:00 +0100
Actual result:
--------------
Sun, 25 Mar 2012 03:00:00 +0200
Sun, 25 Mar 2012 03:00:00 +0200
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61530&edit=1
Thread (4 messages)