I want to check the time
Eastern Daylight Time Time zone in Washington, DC, USA (GMT-4) Thursday, May 9, 2019, 8:11 PM
However,
$ TZ="EDT" date
Fri May 10 00:12:25 EDT 2019
"EST" works properly
$ TZ="EST" date
Thu May 9 19:13:11 EST 2019
What's the problem?
date
command doesn't know "EDT" timezone. If a timezone which isn't supported is passed in TZ the output will indeed show with entered time zone but time shown will be UTC.Supported time zones are listed in /usr/share/zoneinfo/. As of now time zones that can be used as a value for "TZ" are:
The time zone for EDT is "EST5EDT". The output of
TZ="EST5EDT" date
as of 10 May 2019 02:11:26 UTC:Or use city's name where EDT is used. Examples: America/Kentucky/Louisville, America/Kentucky/Monticello, America/New_York, Canada/Eastern, etc.
Why EDT is EST5EDT?
In short, it is a standard. Time zones are written like Timezone-Offset. Here - is minus or it can be said for time zones which are ahead of UTC are written like Timezone-Offset and for time zones that are behind UTC, it is written as TimezoneOffset. If the time zone has a pretty name like Eastern Standard Time, it can be written as EST or EST5. Both will produce same results.
Now, Daylight Saving Time (DST) isn't observed everywhere (for example, India). For time zones where it is observed, time zones are written as Timezone-OffsetTimezoneDST, example: EET-2EETDST (Cyprus) but if DST has a fancy name like BST (British Summer Time), it is written as Timezone-OffsetFancy_name, i.e. GMT0BST. Similary, EDT is EST5EDT. On this Oracle document you can see all standardized time zones.
EDT
is ambiguous when considered internationally. You can get the time you are seeking by doing