问题
I know that ET (Eastern Time) has the DST from EST and EDT, but im looking for that timezone in different libraries of different programming languages and ET is not an option, but EST5EDT is.
Thanks.
回答1:
Short answer: No, They are not equal because EST5EDT
doesn't have any history of changes that US Eastern Time has been through. Use America/New_York
instead, which does.
Longer answer:
EST5EDT
is a POSIX time zone definition which can be used in a TZ
environment variable on many systems. This format is described in the Linux man tz, and in the GNU docs, as well as this article from IBM. All that EST5EDT
tells you is that standard time is UTC-5 and labeled EST
, and daylight time is UTC-4 and labeled EDT
. That's it.
As computer systems evolved over time, it became apparent that POSIX time zones don't contain enough information to properly track time zones of the world. For example, consider the history of DST in the United States, of which the last change occurred in 2007, extending the daylight period by 5 weeks. POSIX definitions cannot represent such data, leading to errors in conversions.
Thus, now the preferred mechanism is to use time zone identifiers from the IANA TZ Database instead (also called "Olson" or "ZoneInfo"). In this database, US Eastern Time is represented by the identifier America/New_York
. It also has an alias of US/Eastern
, and you can use either in most libraries (JavaScript, Python, etc.). You can find a complete list of identifiers here.
You may notice that EST5EDT
appears as one of the identifiers, as does EST
, but not EDT
. These are artifacts of history, due to a period where certain identifiers in the TZ database needed to be backwards compatible with POSIX time zone definitions. You should consider these deprecated now, and only use the Area/Locality
forms of identifiers.
来源:https://stackoverflow.com/questions/54946291/is-est5edt-equal-to-et