Do you know the “Olson database”? It’s the database in which all the timezones of the world are described. The timezones of the present - and also of the past. See the wikipedia article tz database for more information.

The database is nowadays maintained and published by IANA - the Internet Assigned Numbers Authority. The latest release can be downloaded on the homepage.

So, what exactly is in the database now:

  • The names of the timezones, such as “Europe/Berlin” or “America/New York”.
  • The codes of the timezones, such as “CET” or “EST”.
  • The offsets of the timezones to UTC, e.g. UTC+1 or UTC-5.
  • The rules, when to switch to daylight saving time and back.
  • It also contains historical timezones such as “Europe/Büsingen”

The data is needed in order to interpret a given date time, to calculate the local time in relation to UTC or to validate a given date. E.g. “February 1st 2017 CEST” is not a valid date, since the daylight saving time starts only after March 26. In Java, you can verify such dates by using ZonedDateTime.ofStrict().

The database is updated regularly - whenever a country published a new law, which defines the timezone of the country or changes the dates, when the switch from/to summer time is going to happen. Sometimes the daylight saving time is simply skipped or is maintained longer than a season.

The database is essentially a collection of text files. Let’s have a look at the archive contents. At the time of writing this post, the version 2016j was the latest one:

The file NEWS contains the changelog. E.g. “Saratov, Russia moves from +03 to +04 on 2016-12-04”. Such things happen. And if you run a computer there and haven’t an updated timezone database, it would display the wrong local time…

The file leapseconds contains the list of introduced extra seconds. The last one was added on December 31st 2016.

The file zone1970.tab contains a list of timezones along with the country code and geo coordinates of the main city. E.g. DE +5230+01322 Europe/Berlin. This is useful, if you want to highlight the timezone on a map. Berlin is apparently at 52°30’N, 13°22’ East.

Now to the details. The file europe contains all the information about European timezones. Let’s scroll to Europe/Berlin:

# Zone  NAME            GMTOFF  RULES   FORMAT  [UNTIL]
Zone    Europe/Berlin   0:53:28 -       LMT     1893 Apr
                        1:00    C-Eur   CE%sT   1945 May 24  2:00
                        1:00 SovietZone CE%sT   1946
                        1:00    Germany CE%sT   1980
                        1:00    EU      CE%sT

Since 1981, we use the rule from the European Union for daylight saving time. We have an offset to UTC/GMT of 1 hour. The code is either CET or CEST, depending on the summer time.

The rule EU looks like this:

# Rule  NAME    FROM    TO      TYPE    IN      ON      AT      SAVE    LETTER/S
Rule    EU      1977    1980    -       Apr     Sun>=1   1:00u  1:00    S
Rule    EU      1977    only    -       Sep     lastSun  1:00u  0       -
Rule    EU      1978    only    -       Oct      1       1:00u  0       -
Rule    EU      1979    1995    -       Sep     lastSun  1:00u  0       -
Rule    EU      1981    max     -       Mar     lastSun  1:00u  1:00    S
Rule    EU      1996    max     -       Oct     lastSun  1:00u  0       -

Since 1981, summer time begins always on the last Sunday in March. It starts exactly at 1:00 UTC - which is 2:00 CET. One hour is added, so that the wall clock switches to 3:00 CEST. The summer time always ends on the last Sunday in October. At 1:00 UTC, which is 3:00 CEST. The wall clock jumps back to 2:00 CET. Before 1981, the summer time ended already in September.

Interesting is the LMT (Local Mean Time) used until 1893. A completely different time base, at a time before UTC or GMT was adopted.

Last thing to check: When does the US switch daylight saving times? There is always some overlapping between the European switch and the US… Let’s see: File northamerica:

Rule    US      2007    max     -       Mar     Sun>=8  2:00    1:00    D
Rule    US      2007    max     -       Nov     Sun>=1  2:00    0       S

So, the summer time starts since 2007 always on the first Sunday on or after the 8th of March. Interesting is, that the switch takes place at the local (wall clock) time at 2:00. The summer time ends always on the first Sunday on or after the 1st of November.

The file Theory is also interesting - especially the paragraph about timezones on the Mars… Or do you want to know, when the big bang happened? Have a look at zic.c and search for the constant BIG_BANG.