Bug #79316 [NEW]: DateTime initiated with EST time zone behaving incorrectly
| From: | niklas dot lampen at supermetrics dot com | Date: | Fri, 28 Feb 2020 10:57:18 +0000 |
| Subject: | Bug #79316 [NEW]: DateTime initiated with EST time zone behaving incorrectly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-225774@lists.php.net to get a copy of this message | ||
From: niklas dot lampen at supermetrics dot com
Operating system:
PHP version: 7.4.3
Package: Date/time related
Bug Type: Bug
Bug description:DateTime initiated with EST time zone behaving incorrectly
Description:
------------
When initiating DateTime with time zone string 'EST', the hours are
wrong, while the time zone correction is correct.
When using DateTimeZone to set time zone, it works as expected. With
other time zones the shorthand works correctly.
Test script:
---------------
echo (new DateTime('EST'))->format('c');
echo PHP_EOL;
echo (new DateTime('now', new DateTimeZone('EST')))->format('c');
echo PHP_EOL . PHP_EOL;
echo (new DateTime('UTC'))->format('c');
echo PHP_EOL;
echo (new DateTime('now', new DateTimeZone('UTC')))->format('c');
echo PHP_EOL . PHP_EOL;
echo (new DateTime('America/New_York'))->format('c');
echo PHP_EOL;
echo (new DateTime('now', new
DateTimeZone('America/New_York')))->format('c');
Expected result:
----------------
2020-02-28T05:46:26-05:00
2020-02-28T05:46:26-05:00
2020-02-28T10:46:26+00:00
2020-02-28T10:46:26+00:00
2020-02-28T05:46:26-05:00
2020-02-28T05:46:26-05:00
Actual result:
--------------
2020-02-28T11:46:26-05:00
2020-02-28T05:46:26-05:00
2020-02-28T10:46:26+00:00
2020-02-28T10:46:26+00:00
2020-02-28T05:46:26-05:00
2020-02-28T05:46:26-05:00
--
Edit bug report at https://bugs.php.net/bug.php?id=79316&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79316&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79316&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79316&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79316&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79316&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79316&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79316&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79316&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79316&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79316&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79316&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79316&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79316&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79316&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79316&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79316&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79316&r=mysqlcfg