|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-02-28 11:37 UTC] cmb@php.net
-Status: Open
+Status: Not a bug
-Assigned To:
+Assigned To: cmb
[2020-02-28 11:37 UTC] cmb@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 22 01:00:02 2025 UTC |
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