Bug #79396 [Opn->Csd]: DateTime hour incorrect during DST jump forward using setTime
Edit report at https://bugs.php.net/bug.php?id=79396&edit=1
ID: 79396
Updated by: cmb@php.net
Reported by: n at tebru dot net
Summary: DateTime hour incorrect during DST jump forward
using setTime
-Status: Open
+Status: Closed
Type: Bug
Package: Date/time related
Operating System: MacOS
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of nate.brunette@wheniwork.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d70058a139f3a45898e1f270c840fb64ea1a09f0
Log: Fix #79396: DateTime hour incorrect during DST jump forward
Previous Comments:
------------------------------------------------------------------------
[2020-03-18 20:12:43] n at tebru dot net
The following pull request has been associated:
Patch Name: Fixing issue with setTime during DST jump
On GitHub: https://github.com/php/php-src/pull/5276
Patch: https://github.com/php/php-src/pull/5276.patch
------------------------------------------------------------------------
[2020-03-18 20:01:27] n at tebru dot net
Description:
------------
When using DateTime::setTime() and setting the time to a time that doesn't exist (during a DST
jump forward), the timestamp is correct, but the hour does not move forward.
Test script:
---------------
$tz = new DateTimeZone('America/Chicago');
$date = new DateTime('2020-03-08 01:00:00', $tz);
$date->setTime(2,0);
var_dump($date->format(DateTime::ATOM));
Expected result:
----------------
string(25) "2020-03-08T03:00:00-05:00"
Actual result:
--------------
string(25) "2020-03-08T02:00:00-05:00"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79396&edit=1
Thread (3 messages)