Bug #61530 [Asn->Dup]: DateTimeInterval subtracting wrong on summertime Threshold

From: Date: Sun, 19 Mar 2017 10:14:23 +0000
Subject: Bug #61530 [Asn->Dup]: DateTimeInterval subtracting wrong on summertime Threshold
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207937@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61530&edit=1 ID: 61530 Updated by: heiglandreas@php.net Reported by: nicolas dot douillet at gmail dot com Summary: DateTimeInterval subtracting wrong on summertime Threshold -Status: Assigned +Status: Duplicate Type: Bug Package: Date/time related Operating System: Debian / Linux PHP Version: 5.3.10 Assigned To: derick Block user comment: N Private report: N New Comment: We're now tracking this in https://bugs.php.net/bug.php?id=74274 Previous Comments: ------------------------------------------------------------------------ [2014-01-17 13:59:06] jimmyraynor at gmail dot com 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. ------------------------------------------------------------------------ [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

« previous php.bugs (#207937) next »