0

(This question is similar to Long form name of timezone in NodaTime but different).

Every timezone file in /usr/share/zoneinfo has 0 or more timezone abbreviations. For example, America/Chicago has five abbreviations: CDT, CPT, CST, CWT, and EST. For reference, I found these by doing this:

cd /usr/share/zoneinfo 
zdump -v America/Chicago | perl -anle 'print $F[13]' | sort | uniq 

Each combination of file and abbreviation represents, in some sense, a different timezone. For the America/Chicago example, not all of these timezones are still in use.

My question: where can I find a list of filename/abbreviation combinations mapped to long form timezone names?

The "America/Chicago" section of what I'm seeking may look something like this:

Filename Abbreviation Full Name 

America/Chicago CDT Central Daylight Time 
America/Chicago CPT [no longer used] 
America/Chicago CST Central Standrad Time 
America/Chicago CWT [no longer used] 
America/Chicago EST Eastern Standard Time 

(I'm OK with ununsed timezones not being named).

I'm familiar with CLDR (http://cldr.unicode.org/), but the common/supplemental/windowsZones.xml file therein appears to be nontrivially inaccurate (it's also slightly incomplete, but that's not as big a deal). For example, this line (the only line matching CST6CDT):

<mapZone other="Central Standard Time" territory="ZZ" type="CST6CDT"/> 

states that the name of the CST6CDT time zone is "Central Standard Time", which is incorrect.

CST6CDT is generically called "Central Time", and is GMT-5 ("Central Daylight Time") during daylight savings time and GMT-6 ("Central Standard Time") outside of daylight savings time.

Calling it "Central Standard Time" year-round is incorrect. Calling it "Central Time" year-round would be acceptable, but it would be nice to distinguish between Standard and Daylight time.

I considered looking for an "abbreviation to long name" translator, but this wouldn't work because /usr/share/zoneinfo repeats abbreviations. For example, "EST" means "Eastern Standard Time" in the file "EST5EDT", but "Australian Eastern Standard Time" in the file "Australia/Melbourne".

I've considered using common/supplemental/windowsZones.xml and then replacing 'standard' with 'daylight' if the isdst flag is set for the specific instant in time I'm considering, but this seems kludgey.

Any help appreciated.

Community
  • 1
  • 1
  • CLDR is much more than just the windows mapping file, and the Windows ID is not a display name anyway. I'll elaborate more in an answer later today. – Matt Johnson-Pint Nov 03 '15 at 15:13
  • Question before I start on the longer answer - What programming language are you working with? If it's Java or C, then the answer is simply to use [ICU](http://icu-project.org) which already consumes the CLDR properly and gives you simple functions to get the generic, standard, and daylight forms of the short and long names. – Matt Johnson-Pint Nov 03 '15 at 17:10
  • And if you're planning on consuming the CLDR directly, then you really should read sections 5, 6, and 7 of [part 4 of the LDML specification](http://www.unicode.org/reports/tr35/tr35-dates.html#Contents) thoroughly. – Matt Johnson-Pint Nov 03 '15 at 17:14
  • @MattJohnson Actually, I think I answered my own question in the linked question. Probably should have indicated that here. –  Nov 03 '15 at 17:16
  • Ok, then go ahead and close this one. Though I still suggest you read the spec, as it can be more complicated than just reading from a single xml file. You also have to consider meta zones, overrides, location-based formatting defaults, the hierarchy of locales within a language, etc. Like I said, use a library if you can. – Matt Johnson-Pint Nov 03 '15 at 17:27
  • In other words - it's harder than you think. :) – Matt Johnson-Pint Nov 03 '15 at 17:27
  • Possible duplicate of [Long form name of timezone in NodaTime](http://stackoverflow.com/questions/25085981/long-form-name-of-timezone-in-nodatime) –  Nov 03 '15 at 17:29
  • Actually, since I'm just looking for the English names, it wasn't that difficult. –  Nov 03 '15 at 17:30
  • It's not a simple lookup. You'll only find direct names for those zones that have overrides. Many zone names are derived from their country names. Take a look at all of the hoops I had to jump through [in my implementation](https://github.com/mj1856/TimeZoneNames/blob/master/TimeZoneNames/TimeZoneNames.cs#L75-L211). You also have to remap for CLDR canonicalization, which can be different than TZDB canonicalization (`Asia/Kolkata` vs `Asia/Calcutta`, etc.) – Matt Johnson-Pint Nov 03 '15 at 17:50
  • https://github.com/barrycarter/bcapps/blob/master/ASTRO/tz2name.txt (I've pretty much done this already, found the special cases, etc-- I'll look at your implementation too, but I think I've got what I need) –  Nov 03 '15 at 19:14

0 Answers0