Bug #79396 [NEW]: DateTime hour incorrect during DST jump forward using setTime
From: n at tebru dot net
Operating system: MacOS
PHP version: Irrelevant
Package: Date/time related
Bug Type: Bug
Bug description:DateTime hour incorrect during DST jump forward using setTime
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 bug report at https://bugs.php.net/bug.php?id=79396&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79396&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79396&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79396&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79396&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79396&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79396&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79396&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79396&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79396&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79396&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79396&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79396&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79396&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79396&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79396&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79396&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79396&r=mysqlcfg
Thread (3 messages)
- n at tebru dot net