olga olga - 1 month ago 7
Javascript Question

IANA (Internet Assigned Numbers Authority) data files and data from www.timeanddate.com

How to estimate local time using IANA (Internet Assigned Numbers Authority) data files?

On this website i find the following data:
https://www.timeanddate.com/time/zone/uk/london

2015 Sun, 29 Mar, 01:00GMT → BST+1 hour (DST start)UTC+1h
Sun, 25 Oct, 02:00BST → GMT-1 hour (DST end)UTC
2016 Sun, 27 Mar, 01:00GMT → BST+1 hour (DST start)UTC+1h
Sun, 30 Oct, 02:00BST → GMT-1 hour (DST end)UTC
2017 Sun, 26 Mar, 01:00GMT → BST+1 hour (DST start)UTC+1h
Sun, 29 Oct, 02:00BST → GMT-1 hour (DST end)UTC
2018 Sun, 25 Mar, 01:00GMT → BST+1 hour (DST start)UTC+1h
Sun, 28 Oct, 02:00BST → GMT-1 hour (DST end)UTC
2019 Sun, 31 Mar, 01:00GMT → BST+1 hour (DST start)UTC+1h
Sun, 27 Oct, 02:00BST → GMT-1 hour (DST end)UTC


As you can see, the Europe/London time change rule is different every year : 2018 rule applies from 25th March on 2019 from 31st March, etc..

But i can not find this information on IANA data distribution.
https://www.iana.org/time-zones

From tzdata2016h.tar.gz, extracted file
europe
:

# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Europe/London -0:01:15 - LMT 1847 Dec 1 0:00s
0:00 GB-Eire %s 1968 Oct 27
1:00 - BST 1971 Oct 31 2:00u
0:00 GB-Eire %s 1996
0:00 EU GMT/BST


Maybe i do not understand how to use IANA data? How to extract IANA datafile?

Answer

You first look at the Zone entry for Europe/London:

# Zone  NAME             GMTOFF RULES   FORMAT  [UNTIL]
Zone    Europe/London   -0:01:15 -      LMT     1847 Dec  1  0:00s
                         0:00   GB-Eire %s      1968 Oct 27
                         1:00   -       BST     1971 Oct 31  2:00u
                         0:00   GB-Eire %s      1996
                         0:00   EU      GMT/BST

Each row ends in an [UNTIL] date, except for the last one. When there is no [UNTIL] date, infinitely far in the future is implied. So London is currently goverened by the last row in the table above which says that the UTC offset is 0:00, with daylight saving rules governed by the Rule EU, and the abbreviations to be used are GMT for "standard" time and BST for daylight saving time.

Now go find the Rule EU:

# 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       -

You're looking for the Rules that are currently in effect. There are two of them at the moment, the last two rows.

The second to last row says that for each year, starting with 1981, on the last Sunday of March at 01:00 UTC, 1:00 is added to the UTC offset (specified by the Zone). The last column which contains S is not used in this example. But if the abbreviation specified in the Zone contained a %s, then this letter would be substituted in for the %s.

The last row says that for each year, starting with 1996, on the last Sunday of October at 01:00 UTC, 0:00 is added to the UTC offset (specified by the Zone).

Matt Johnson adds in the comments below:

You may also be interested in iana.org/time-zones/repository/tz-how-to.html

I thought this such an important comment that it should be in the answer for higher visibility. Thanks Matt!