Req #81194 [Nab]: Get Timezone abbreviation
| From: | syl dot fabre at gmail dot com | Date: | Wed, 23 Jun 2021 09:11:38 +0000 |
| Subject: | Req #81194 [Nab]: Get Timezone abbreviation | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-234603@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81194&edit=1
ID: 81194
User updated by: syl dot fabre at gmail dot com
Reported by: syl dot fabre at gmail dot com
Summary: Get Timezone abbreviation
Status: Not a bug
Type: Feature/Change Request
Package: Date/time related
Operating System: Irrelevant
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
This was not a bug report but a feature request :)
Thank you for the explanation about daylight saving.
I understand now why the abbreviation comes from \DateTime::format() and cannot come from the
\DateTimeZone itself.
have a nice day
Previous Comments:
------------------------------------------------------------------------
[2021-06-23 08:28:56] derick@php.net
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
The abbreviation depends on the date, for
example whether Daylight Saving Time is
in effect (EDT vs EST), and also on
historical data.
Abbreviations are not uniquely
identifying a specific timezone either
(PST can also be Pakistan Standard Time).
Because these abbreviations are strictly
display only marks (like am/pm), if would
not be appropriate to have a specific
method for this, and certainly not
straight on DateTimezone.
------------------------------------------------------------------------
[2021-06-23 07:58:08] syl dot fabre at gmail dot com
Description:
------------
PHP uses the tz database for timezone with names like America/New_York.
But most people in the US use abbreviated names like EST (for instance https://www.juneteenthny.com/schedule)
This abbreviated name can be found with (new \DateTime('now',
'America/New_York'))->format('T') as explained in this comment: https://www.php.net/manual/en/function.timezone-abbreviations-list.php#97472
I would expect to get this abbreviation from a public method of \DateTimeZone with something like
this:
$tz = new \DateTimeZone('America/New_York');
$tz->getAbbreviation();
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81194&edit=1