|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79396 DateTime hour incorrect during DST jump forward using setTime
Submitted: 2020-03-18 20:01 UTC Modified: 2020-03-19 07:55 UTC
From: n at tebru dot net Assigned: cmb (profile)
Status: Closed Package: Date/time related
PHP Version: Irrelevant OS: MacOS
Private report: No CVE-ID: None
 [2020-03-18 20:01 UTC] n at tebru dot net
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);

Expected result:
string(25) "2020-03-08T03:00:00-05:00"

Actual result:
string(25) "2020-03-08T02:00:00-05:00"


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-03-18 20:12 UTC] n at tebru dot net
The following pull request has been associated:

Patch Name: Fixing issue with setTime during DST jump
On GitHub:
 [2020-03-19 07:54 UTC]
Automatic comment on behalf of
Log: Fix #79396: DateTime hour incorrect during DST jump forward
 [2020-03-19 07:54 UTC]
-Status: Open +Status: Closed
 [2020-03-19 07:55 UTC]
-Assigned To: +Assigned To: cmb
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Feb 28 07:01:28 2024 UTC