Bug #66187 [Opn->Asn]: DateTime->add() incorrect on BST boundry

From: Date: Fri, 29 Nov 2013 22:23:07 +0000
Subject: Bug #66187 [Opn->Asn]: DateTime->add() incorrect on BST boundry
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183017@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66187&edit=1

 ID:                 66187
 Updated by:         bwoebi@php.net
 Reported by:        andrewpate08 at hotmail dot com
 Summary:            DateTime->add() incorrect on BST boundry
-Status:             Open
+Status:             Assigned
 Type:               Bug
 Package:            Date/time related
-Operating System:   Linux/Windows XP
+Operating System:   Irrelevant
 PHP Version:        Irrelevant
-Assigned To:        
+Assigned To:        derick
 Block user comment: N
 Private report:     N

 New Comment:

http://3v4l.org/7DUjs#v530

There's effectively something wrong: 1 hour 10 mins added in code, but
from 27-10-2013 00:55:00+01:00
to 27-10-2013 02:05:00+00:00
2 hours 10 mins are added (=> timezone change is not included)


Previous Comments:
------------------------------------------------------------------------
[2013-11-27 23:01:39] andrewpate08 at hotmail dot com

Description:
------------
British summertime does not actually end until....
27-10-2013 01:59:59+01:00  (BST)
at which point, one second later it kicks back to GMT...
27-10-2013 01:00:00+00:00 (GMT)

It seems calculations involving DateTime->add() and the 'Europe/London' DateTimeZone
crossing the END of British summertime (BST) gives an incorrect result. 

On the day British summertime ends it is not until 2:00AM (BST) which is 1:00AM (GMT) that clocks
switch from BST to GMT (i.e. go back from 2:00 to 1:00) 

Test script:
---------------
<?php
$start = new DateTime("2013-10-27 00:55:00", new DateTimeZone('Europe/London'));
$step = DateInterval::createFromDateString("600 seconds");
echo "start = " . $start->format('d-m-Y H:i:sP') . "<br />";
$start->add($step);
echo "start = " . $start->format('d-m-Y H:i:sP') . "<br />";
?>


Expected result:
----------------
start = 27-10-2013 00:55:00+01:00
start = 27-10-2013 01:05:00+00:00


Actual result:
--------------
start = 27-10-2013 00:55:00+01:00
start = 27-10-2013 01:05:00+01:00


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



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


Thread (6 messages)

« previous php.bugs (#183017) next »