Bug #79316 [Opn->Nab]: DateTime initiated with EST time zone behaving incorrectly
| From: | cmb@php.net | Date: | Fri, 28 Feb 2020 11:37:50 +0000 |
| Subject: | Bug #79316 [Opn->Nab]: DateTime initiated with EST time zone behaving incorrectly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-225775@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79316&edit=1
ID: 79316
Updated by: cmb@php.net
Reported by: niklas dot lampen at supermetrics dot com
Summary: DateTime initiated with EST time zone behaving
incorrectly
-Status: Open
+Status: Not a bug
Type: Bug
Package: Date/time related
PHP Version: 7.4.3
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Form <https://www.php.net/manual/en/timezones.others.php>:
| Please do not use any of the timezones listed here (besides
| UTC), they only exist for backward compatible reasons, and may
| expose erroneous behavior.
Previous Comments:
------------------------------------------------------------------------
[2020-02-28 10:57:18] niklas dot lampen at supermetrics dot com
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 this bug report at https://bugs.php.net/bug.php?id=79316&edit=1