[tz] Converting cities to tz identifiers (tangent)

Guy Harris guy at alum.mit.edu
Tue Feb 20 23:04:11 UTC 2018

On Feb 20, 2018, at 2:07 PM, Paul Ganssle <pganssle at gmail.com> wrote:

> In any case, I sympathize with the question of "US/Eastern" vs. "America/New_York". It does seem like there are times where the time zone you want is "the US Eastern time zone",

What is meant by "the US Eastern time zone"?  The zone that, barring adjustments such as Daylight Savings Time, is 5 hours west of UTC - and that may include locations that do make DST adjustments and locations that don't?

If so, then all that asking for "the US Eastern time zone" will get you is "5 hours west of UTC"; it won't get you any rules for adjustments, because not all locations in the Eastern time zone will necessarily follow the same rules.  Indianapolis, for example, has an interesting time zone history:

Rule Indianapolis 1941	only	-	Jun	22	2:00	1:00	D
Rule Indianapolis 1941	1954	-	Sep	lastSun	2:00	0	S
Rule Indianapolis 1946	1954	-	Apr	lastSun	2:00	1:00	D
Zone America/Indiana/Indianapolis -5:44:38 - LMT	1883 Nov 18 12:15:22
			-6:00	US	C%sT	1920
			-6:00 Indianapolis C%sT	1942
			-6:00	US	C%sT	1946
			-6:00 Indianapolis C%sT	1955 Apr 24  2:00
			-5:00	-	EST	1957 Sep 29  2:00
			-6:00	-	CST	1958 Apr 27  2:00
			-5:00	-	EST	1969
			-5:00	US	E%sT	1971
			-5:00	-	EST	2006
			-5:00	US	E%sT

which includes periods where it was in the Eastern time zone but didn't do DST.  *Currently*, it does DST, but it didn't do so in the past and it, or other locations, could conceivably do so in the future.  If we ask about the US Mountain time zone, instead, there are *currently* locations in that zone that do DST and locations that don't.

The tzdb is not currently the place to ask about "the US Eastern time zone", because it doesn't have any mechanism to ask what the UTC offset of the "US Eastern time zone" is.  You can ask about the current un-adjusted UTC offset for a given location in the Eastern time zone (which might be different from the un-adjusted UTC offset for that location in the past, as per the above information for Indianapolis).

> regardless of whether that represents the time in New York or not, in which case you *can* eagerly map to "US/Eastern", whereas if you want "the current time in <some city>", for the most part you *cannot* eagerly map to a given time zone.

Remember, the things that are identified by tz database identifiers are *not* time zones, the derivation of the "tz" part of "tz database" notwithstanding.  They're regions that may have, over time, been in more than one time zone (see above).

More information about the tz mailing list