Read tz database

Read tz database

Have you ever written a code that deals with dates and times in foreign regions? Have you ever written code that takes daylight savings time into account?

In this article, I will introduce the tz database, which many people, including Japan, may have taken care of without noticing when dealing with the date and time, and I will also publish a record of reading the definition information.

I think there are many things that aren't accurate, so if you have any questions, please leave a comment or edit request!

1. What is tz database?

The tz database is published on this page.

Quoted from Wikipedia.

The tz database is data recorded by volunteers collaborating on standard time (time zone) information in each region of the world. It is primarily intended for use in computer programs and operating systems [3]. The abbreviation is tz data, also known as zoneinfo database, and is also called the Olson database after Arthur David Olson, who contributed to the creation of the database. [4] Paul Eggert is the editor and administrator of the tz database. [5] Since October 2011, The Internet Corporation for Assigned Names and Numbers (ICANN) and the Internet Assigned Numbers Authority (IANA) have been added to the management.

Japan has long adopted standard time of +9 hours from Coordinated Universal Time (UTC) without adopting daylight saving time, but it is frequently changed by politics in some foreign regions. For example, recently, Brazil has abolished summertime from 2019, and Russia's Volgograd has changed the standard time from UTC + 03 to UTC + 04 from October 28, 2018.

The tz database is a collection of data that defines what date and time rules each region has from when to when, thanks to the efforts of many volunteers, and the OS and date and time library are specified by referring to this tz database. You will be able to calculate the appropriate date and time for your region.

The version consists of " " and increases like 2018h-> 2018i-> 2019a-> 2019b. The latest as of December 5, 2019 is 2019c.

The ID of each area is like " / ".

2. Usage example

The following two points are listed here.

Linux

Check if you are using tz database on your Ubuntu 18.04.

The package "tzdata" seems to handle tz database from the version name of.

$ apt show tzdata
Package: tzdata
Version: 2019c-0ubuntu0.18.04
Priority: important
Section: libs
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: GNU Libc Maintainers <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 3,107 kB
Provides: tzdata-buster
Depends: debconf (>= 0.5) | debconf-2.0
Replaces: libc0.1, libc0.3, libc6, libc6.1
Homepage: https://www.iana.org/time-zones
Task: minimal
Supported: 5y
Download-Size: 190 kB
APT-Manual-Installed: yes
APT-Sources: http://jp.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
Description:Time zone and daylight saving time data
This package contains the data needed to implement local time in many typical locations around the world. Political party changes to time zone boundaries, UTC
It is updated regularly to reflect the offset and the Summer Time Rule.

When I checked the installation destination of the tzdata package, it seems that it is installed in / user / share / zoneinfo.

$ dpkg -L tzdata
/.
/usr
/usr/sbin
/usr/sbin/tzconfig
/usr/share
/usr/share/doc
/usr/share/doc/tzdata
/usr/share/doc/tzdata/README.Debian
/usr/share/doc/tzdata/changelog.Debian.gz
/usr/share/doc/tzdata/copyright
/usr/share/zoneinfo
/usr/share/zoneinfo/Africa
/usr/share/zoneinfo/Africa/Abidjan
/usr/share/zoneinfo/Africa/Accra
/usr/share/zoneinfo/Africa/Addis_Ababa
/usr/share/zoneinfo/Africa/Algiers
/usr/share/zoneinfo/Africa/Bangui
/usr/share/zoneinfo/Africa/Bissau
/usr/share/zoneinfo/Africa/Blantyre
/usr/share/zoneinfo/Africa/Casablanca

(Abbreviation)

/usr/share/zoneinfo/right/US/Hawaii
/usr/share/zoneinfo/right/US/Indiana-Starke
/usr/share/zoneinfo/right/US/Michigan
/usr/share/zoneinfo/right/US/Mountain
/usr/share/zoneinfo/right/US/Pacific
/usr/share/zoneinfo/right/US/Pacific-New
/usr/share/zoneinfo/right/US/Samoa
/usr/share/zoneinfo/right/UTC
/usr/share/zoneinfo/right/Universal
/usr/share/zoneinfo/right/Zulu

It's not clear from this information alone how this data is handled, but at least Ubuntu seems to include a tz database.

Moment.js

Moment.js is a well-known library that handles JavaScript date and time. Moment-timezone is a plugin for handling timezones in this Moment.js.

You can handle the time zone as follows.

sample.js


const moment = require('moment-timezone');

console.log(moment.tz('2019-01-05 12:00', 'UTC').tz('America/New_York').format()); // 2019-01-05T07:00:00-05:00
console.log(moment.tz('2019-07-05 12:00', 'UTC').tz('America/New_York').format()); // 2019-07-05T08:00:00-04:00

If you look inside the data directory of moment-timezone, you will find information that seems to have been generated based on the tz database.

3. Read the definition of tz database

From here, I would like to see what the current time zone rules for each region are. The reading is described in tz-how-to.html included in the tz database.

The version of tz database you read this time is 2019c. Also, from now on, the word "present" should be interpreted as referring to as of December 6, 2019.

Asia/Tokyo

As of now, Japan does not use daylight saving time, but uses UTC + 9 throughout the year. Based on that, let's look at the definition of Tokyo in Japan.

The definition of Tokyo is Asia / Tokyo, which is as follows.

https://github.com/eggert/tz/blob/2019c/asia#L1910-L1912

# Zone	NAME		STDOFF	RULES	FORMAT	[UNTIL]
Zone	Asia/Tokyo	9:18:59	-	LMT	1887 Dec 31 15:00u
			9:00	Japan	J%sT

Except for comments, the first line is set to UTC time until 15:00 on December 31, 1887, so the current setting should apply the definition of the second line with UNTIL not set.

The second line now has a UTC offset of 9:00, and the format of the timezone abbreviation used at that time is "J% sT" according to the definition of Rule Japan described later. "% S" is set to the letter LETTER, which is the column defined in Japan's Rule, which will be described later, and "S" or "D" is set, and "JST" (Japan Standard Time) or "JDT" (Japan Daylight). Saving Time).

Let's take a look at the rules of "Japan".

https://github.com/eggert/tz/blob/2019c/asia#L1873-L1877

# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
Rule	Japan	1948	only	-	May	Sat>=1	24:00	1:00	D
Rule	Japan	1948	1951	-	Sep	Sat>=8	25:00	0	S
Rule	Japan	1949	only	-	Apr	Sat>=1	24:00	1:00	D
Rule	Japan	1950	1951	-	May	Sat>=1	24:00	1:00	D

Except for comments, the first line is a rule only for 1948, and it will be JDT from 24:00 on the first Saturday of May, and the daylight saving time will be +1 hour off from standard time. The second line is the rule for the period 1948-1951, which will be JST from 25:00 on the second Saturday of September. The third line is a rule only for 1949, and it will be JDT from 24:00 on the first Saturday of April, and the daylight saving time will be +1 hour off from standard time. The fourth line is the rule for the period from 1950 to 1951, which will be JDT from 24:00 on the first Saturday of May, and the daylight saving time will be +1 hour off standard time. These seem to be the rules when daylight saving time was temporarily adopted after the war.

And it seems that the current "Japan" rules that I want to confirm are not written.

I couldn't find what would happen if no rules were set, but given the current situation in Japan, if no rules for that period were found, the Zone definition would remain STDOFF and the offset would be I'm guessing it will be 9:00, but what about it? I would like to find out at a later date.

I wondered if there was a definition of a time zone abbreviation such as JST or JDT somewhere, but I couldn't find anything other than the following comments.

https://github.com/eggert/tz/blob/2019c/asia#L40-L55

# The following alphabetic abbreviations appear in these tables
# (corrections are welcome):
#	     std  dst
#	     LMT	Local Mean Time
#	2:00 EET  EEST	Eastern European Time
#	2:00 IST  IDT	Israel
#	5:30 IST	India
#	7:00 WIB	west Indonesia (Waktu Indonesia Barat)
#	8:00 WITA	central Indonesia (Waktu Indonesia Tengah)
#	8:00 CST	China
#	8:00 HKT  HKST	Hong Kong (HKWT* for Winter Time in late 1941)
#	8:00 PST  PDT*	Philippines
#	8:30 KST  KDT	Korea when at +0830
#	9:00 WIT	east Indonesia (Waktu Indonesia Timur)
#	9:00 JST  JDT	Japan
#	9:00 KST  KDT	Korea when at +09

America/Los_Angeles

Currently, in the United States, daylight saving time is from 2:00 on the second Sunday in March to 2:00 on the first Sunday in November. With that in mind, let's look at the definition of Los Angeles in the United States.

The definition of Los Angeles is America / Los_Angeles, which is:

https://github.com/eggert/tz/blob/2019c/northamerica#L562-L566

# Zone	NAME		STDOFF	RULES	FORMAT	[UNTIL]
Zone America/Los_Angeles -7:52:58 -	LMT	1883 Nov 18 12:07:02
			-8:00	US	P%sT	1946
			-8:00	CA	P%sT	1967
			-8:00	US	P%sT

The "% s" of FORMAT is set to the character LETTER, which is the column of the US rule definition described later, and becomes "PDT", "PST", and so on.

Except for comments, the first to third lines are before 1967, and the current definition of America / Los_Angeles is the fourth line. On the 4th line, the current offset is -8:00, and the format is "P% sT" according to the US rule described later.

Let's take a look at the US rules.

https://github.com/eggert/tz/blob/2019c/northamerica#L173-L186

# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
Rule	US	1918	1919	-	Mar	lastSun	2:00	1:00	D
Rule	US	1918	1919	-	Oct	lastSun	2:00	0	S
Rule	US	1942	only	-	Feb	9	2:00	1:00	W # War
Rule	US	1945	only	-	Aug	14	23:00u	1:00	P # Peace
Rule	US	1945	only	-	Sep	30	2:00	0	S
Rule	US	1967	2006	-	Oct	lastSun	2:00	0	S
Rule	US	1967	1973	-	Apr	lastSun	2:00	1:00	D
Rule	US	1974	only	-	Jan	6	2:00	1:00	D
Rule	US	1975	only	-	Feb	lastSun	2:00	1:00	D
Rule	US	1976	1986	-	Apr	lastSun	2:00	1:00	D
Rule	US	1987	2006	-	Apr	Sun>=1	2:00	1:00	D
Rule	US	2007	max	-	Mar	Sun>=8	2:00	1:00	D
Rule	US	2007	max	-	Nov	Sun>=1	2:00	0	S

For now, it seems that you should refer to the following part.

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

From 2007 to the present, the "US" rule defines that PDT (Pacific Daylight Time), that is, daylight saving time, will be adopted from 2:00 on the second Sunday of March, adding one hour from standard time. It seems. From 2007 to the present, the "US" rule seems to be PST (Pacific Standard Time) from 2:00 on the first Sunday of November.

Africa/Casablanca

Until 2018/10/28, Morocco will use UTC + 0 in standard time and UTC + 1 in daylight saving time. We used to go back to UTC + 0 when Ramadan time comes during summertime and back to UTC + 1 during summertime when Ramadan time ends. From 2018, it will be summer time all year round, and it will be basic UTC + 1, and it will be UTC + 0 in the original standard time only during Ramadan. In addition, the start time and end time of these periods seem to be different every year.

With that in mind, let's take a look at Casablanca in Morocco.

The definition of Casablanca is Africa / Casablanca, which is as follows.

https://github.com/eggert/tz/blob/2019c/africa#L1086-L1091

# Zone	NAME		STDOFF	RULES	FORMAT	[UNTIL]
Zone Africa/Casablanca	-0:30:20 -	LMT	1913 Oct 26
			 0:00	Morocco	+00/+01	1984 Mar 16
			 1:00	-	+01	1986
			 0:00	Morocco	+00/+01	2018 Oct 28  3:00
			 1:00	Morocco	+01/+00

Except for comments, the 4th line was 0 o'clock in standard time until October 28, 2018, and it seems that it followed the rule called Morocco described later. The offset on the last line is 1:00, which also follows the Morocco rule.

I didn't know if I would interpret "+ 00 / + 01" or "+ 01 / + 00" in FORMAT. Does it mean that it is usually on the left side of the "/" and in some cases on the right side?

Let's take a look at Morocco's rules.

https://github.com/eggert/tz/blob/2019c/africa#L897-L1080

# RULE	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
Rule	Morocco	1939	only	-	Sep	12	 0:00	1:00	-
Rule	Morocco	1939	only	-	Nov	19	 0:00	0	-
Rule	Morocco	1940	only	-	Feb	25	 0:00	1:00	-
Rule	Morocco	1945	only	-	Nov	18	 0:00	0	-
Rule	Morocco	1950	only	-	Jun	11	 0:00	1:00	-
Rule	Morocco	1950	only	-	Oct	29	 0:00	0	-
Rule	Morocco	1967	only	-	Jun	 3	12:00	1:00	-
Rule	Morocco	1967	only	-	Oct	 1	 0:00	0	-
Rule	Morocco	1974	only	-	Jun	24	 0:00	1:00	-
Rule	Morocco	1974	only	-	Sep	 1	 0:00	0	-
Rule	Morocco	1976	1977	-	May	 1	 0:00	1:00	-
Rule	Morocco	1976	only	-	Aug	 1	 0:00	0	-
Rule	Morocco	1977	only	-	Sep	28	 0:00	0	-
Rule	Morocco	1978	only	-	Jun	 1	 0:00	1:00	-
Rule	Morocco	1978	only	-	Aug	 4	 0:00	0	-
Rule	Morocco	2008	only	-	Jun	 1	 0:00	1:00	-
Rule	Morocco	2008	only	-	Sep	 1	 0:00	0	-
Rule	Morocco	2009	only	-	Jun	 1	 0:00	1:00	-
Rule	Morocco	2009	only	-	Aug	21	 0:00	0	-
Rule	Morocco	2010	only	-	May	 2	 0:00	1:00	-
Rule	Morocco	2010	only	-	Aug	 8	 0:00	0	-
Rule	Morocco	2011	only	-	Apr	 3	 0:00	1:00	-
Rule	Morocco	2011	only	-	Jul	31	 0:00	0	-
Rule	Morocco	2012	2013	-	Apr	lastSun	 2:00	1:00	-
Rule	Morocco	2012	only	-	Jul	20	 3:00	0	-
Rule	Morocco	2012	only	-	Aug	20	 2:00	1:00	-
Rule	Morocco	2012	only	-	Sep	30	 3:00	0	-
Rule	Morocco	2013	only	-	Jul	 7	 3:00	0	-
Rule	Morocco	2013	only	-	Aug	10	 2:00	1:00	-
Rule	Morocco	2013	2018	-	Oct	lastSun	 3:00	0	-
Rule	Morocco	2014	2018	-	Mar	lastSun	 2:00	1:00	-
Rule	Morocco	2014	only	-	Jun	28	 3:00	0	-
Rule	Morocco	2014	only	-	Aug	 2	 2:00	1:00	-
Rule	Morocco	2015	only	-	Jun	14	 3:00	0	-
Rule	Morocco	2015	only	-	Jul	19	 2:00	1:00	-
Rule	Morocco	2016	only	-	Jun	 5	 3:00	0	-
Rule	Morocco	2016	only	-	Jul	10	 2:00	1:00	-
Rule	Morocco	2017	only	-	May	21	 3:00	0	-
Rule	Morocco	2017	only	-	Jul	 2	 2:00	1:00	-
Rule	Morocco	2018	only	-	May	13	 3:00	0	-
Rule	Morocco	2018	only	-	Jun	17	 2:00	1:00	-
Rule	Morocco	2019	only	-	May	 5	 3:00	-1:00	-
Rule	Morocco	2019	only	-	Jun	 9	 2:00	0	-
Rule	Morocco	2020	only	-	Apr	19	 3:00	-1:00	-
Rule	Morocco	2020	only	-	May	24	 2:00	0	-
Rule	Morocco	2021	only	-	Apr	11	 3:00	-1:00	-
Rule	Morocco	2021	only	-	May	16	 2:00	0	-
Rule	Morocco	2022	only	-	Mar	27	 3:00	-1:00	-
Rule	Morocco	2022	only	-	May	 8	 2:00	0	-
Rule	Morocco	2023	only	-	Mar	19	 3:00	-1:00	-
Rule	Morocco	2023	only	-	Apr	23	 2:00	0	-
Rule	Morocco	2024	only	-	Mar	10	 3:00	-1:00	-
Rule	Morocco	2024	only	-	Apr	14	 2:00	0	-
Rule	Morocco	2025	only	-	Feb	23	 3:00	-1:00	-
Rule	Morocco	2025	only	-	Apr	 6	 2:00	0	-
Rule	Morocco	2026	only	-	Feb	15	 3:00	-1:00	-
Rule	Morocco	2026	only	-	Mar	22	 2:00	0	-
Rule	Morocco	2027	only	-	Feb	 7	 3:00	-1:00	-
Rule	Morocco	2027	only	-	Mar	14	 2:00	0	-
Rule	Morocco	2028	only	-	Jan	23	 3:00	-1:00	-
Rule	Morocco	2028	only	-	Feb	27	 2:00	0	-
Rule	Morocco	2029	only	-	Jan	14	 3:00	-1:00	-
Rule	Morocco	2029	only	-	Feb	18	 2:00	0	-
Rule	Morocco	2029	only	-	Dec	30	 3:00	-1:00	-
Rule	Morocco	2030	only	-	Feb	10	 2:00	0	-
Rule	Morocco	2030	only	-	Dec	22	 3:00	-1:00	-
Rule	Morocco	2031	only	-	Jan	26	 2:00	0	-
Rule	Morocco	2031	only	-	Dec	14	 3:00	-1:00	-
Rule	Morocco	2032	only	-	Jan	18	 2:00	0	-
Rule	Morocco	2032	only	-	Nov	28	 3:00	-1:00	-
Rule	Morocco	2033	only	-	Jan	 9	 2:00	0	-
Rule	Morocco	2033	only	-	Nov	20	 3:00	-1:00	-
Rule	Morocco	2033	only	-	Dec	25	 2:00	0	-
Rule	Morocco	2034	only	-	Nov	 5	 3:00	-1:00	-
Rule	Morocco	2034	only	-	Dec	17	 2:00	0	-
Rule	Morocco	2035	only	-	Oct	28	 3:00	-1:00	-
Rule	Morocco	2035	only	-	Dec	 2	 2:00	0	-
Rule	Morocco	2036	only	-	Oct	19	 3:00	-1:00	-
Rule	Morocco	2036	only	-	Nov	23	 2:00	0	-
Rule	Morocco	2037	only	-	Oct	 4	 3:00	-1:00	-
Rule	Morocco	2037	only	-	Nov	15	 2:00	0	-
Rule	Morocco	2038	only	-	Sep	26	 3:00	-1:00	-
Rule	Morocco	2038	only	-	Oct	31	 2:00	0	-
Rule	Morocco	2039	only	-	Sep	18	 3:00	-1:00	-
Rule	Morocco	2039	only	-	Oct	23	 2:00	0	-
Rule	Morocco	2040	only	-	Sep	 2	 3:00	-1:00	-
Rule	Morocco	2040	only	-	Oct	14	 2:00	0	-
Rule	Morocco	2041	only	-	Aug	25	 3:00	-1:00	-
Rule	Morocco	2041	only	-	Sep	29	 2:00	0	-
Rule	Morocco	2042	only	-	Aug	10	 3:00	-1:00	-
Rule	Morocco	2042	only	-	Sep	21	 2:00	0	-
Rule	Morocco	2043	only	-	Aug	 2	 3:00	-1:00	-
Rule	Morocco	2043	only	-	Sep	 6	 2:00	0	-
Rule	Morocco	2044	only	-	Jul	24	 3:00	-1:00	-
Rule	Morocco	2044	only	-	Aug	28	 2:00	0	-
Rule	Morocco	2045	only	-	Jul	 9	 3:00	-1:00	-
Rule	Morocco	2045	only	-	Aug	20	 2:00	0	-
Rule	Morocco	2046	only	-	Jul	 1	 3:00	-1:00	-
Rule	Morocco	2046	only	-	Aug	 5	 2:00	0	-
Rule	Morocco	2047	only	-	Jun	23	 3:00	-1:00	-
Rule	Morocco	2047	only	-	Jul	28	 2:00	0	-
Rule	Morocco	2048	only	-	Jun	 7	 3:00	-1:00	-
Rule	Morocco	2048	only	-	Jul	19	 2:00	0	-
Rule	Morocco	2049	only	-	May	30	 3:00	-1:00	-
Rule	Morocco	2049	only	-	Jul	 4	 2:00	0	-
Rule	Morocco	2050	only	-	May	15	 3:00	-1:00	-
Rule	Morocco	2050	only	-	Jun	26	 2:00	0	-
Rule	Morocco	2051	only	-	May	 7	 3:00	-1:00	-
Rule	Morocco	2051	only	-	Jun	11	 2:00	0	-
Rule	Morocco	2052	only	-	Apr	28	 3:00	-1:00	-
Rule	Morocco	2052	only	-	Jun	 2	 2:00	0	-
Rule	Morocco	2053	only	-	Apr	13	 3:00	-1:00	-
Rule	Morocco	2053	only	-	May	25	 2:00	0	-
Rule	Morocco	2054	only	-	Apr	 5	 3:00	-1:00	-
Rule	Morocco	2054	only	-	May	10	 2:00	0	-
Rule	Morocco	2055	only	-	Mar	28	 3:00	-1:00	-
Rule	Morocco	2055	only	-	May	 2	 2:00	0	-
Rule	Morocco	2056	only	-	Mar	12	 3:00	-1:00	-
Rule	Morocco	2056	only	-	Apr	23	 2:00	0	-
Rule	Morocco	2057	only	-	Mar	 4	 3:00	-1:00	-
Rule	Morocco	2057	only	-	Apr	 8	 2:00	0	-
Rule	Morocco	2058	only	-	Feb	17	 3:00	-1:00	-
Rule	Morocco	2058	only	-	Mar	31	 2:00	0	-
Rule	Morocco	2059	only	-	Feb	 9	 3:00	-1:00	-
Rule	Morocco	2059	only	-	Mar	16	 2:00	0	-
Rule	Morocco	2060	only	-	Feb	 1	 3:00	-1:00	-
Rule	Morocco	2060	only	-	Mar	 7	 2:00	0	-
Rule	Morocco	2061	only	-	Jan	16	 3:00	-1:00	-
Rule	Morocco	2061	only	-	Feb	27	 2:00	0	-
Rule	Morocco	2062	only	-	Jan	 8	 3:00	-1:00	-
Rule	Morocco	2062	only	-	Feb	12	 2:00	0	-
Rule	Morocco	2062	only	-	Dec	31	 3:00	-1:00	-
Rule	Morocco	2063	only	-	Feb	 4	 2:00	0	-
Rule	Morocco	2063	only	-	Dec	16	 3:00	-1:00	-
Rule	Morocco	2064	only	-	Jan	20	 2:00	0	-
Rule	Morocco	2064	only	-	Dec	 7	 3:00	-1:00	-
Rule	Morocco	2065	only	-	Jan	11	 2:00	0	-
Rule	Morocco	2065	only	-	Nov	22	 3:00	-1:00	-
Rule	Morocco	2066	only	-	Jan	 3	 2:00	0	-
Rule	Morocco	2066	only	-	Nov	14	 3:00	-1:00	-
Rule	Morocco	2066	only	-	Dec	19	 2:00	0	-
Rule	Morocco	2067	only	-	Nov	 6	 3:00	-1:00	-
Rule	Morocco	2067	only	-	Dec	11	 2:00	0	-
Rule	Morocco	2068	only	-	Oct	21	 3:00	-1:00	-
Rule	Morocco	2068	only	-	Dec	 2	 2:00	0	-
Rule	Morocco	2069	only	-	Oct	13	 3:00	-1:00	-
Rule	Morocco	2069	only	-	Nov	17	 2:00	0	-
Rule	Morocco	2070	only	-	Oct	 5	 3:00	-1:00	-
Rule	Morocco	2070	only	-	Nov	 9	 2:00	0	-
Rule	Morocco	2071	only	-	Sep	20	 3:00	-1:00	-
Rule	Morocco	2071	only	-	Oct	25	 2:00	0	-
Rule	Morocco	2072	only	-	Sep	11	 3:00	-1:00	-
Rule	Morocco	2072	only	-	Oct	16	 2:00	0	-
Rule	Morocco	2073	only	-	Aug	27	 3:00	-1:00	-
Rule	Morocco	2073	only	-	Oct	 8	 2:00	0	-
Rule	Morocco	2074	only	-	Aug	19	 3:00	-1:00	-
Rule	Morocco	2074	only	-	Sep	23	 2:00	0	-
Rule	Morocco	2075	only	-	Aug	11	 3:00	-1:00	-
Rule	Morocco	2075	only	-	Sep	15	 2:00	0	-
Rule	Morocco	2076	only	-	Jul	26	 3:00	-1:00	-
Rule	Morocco	2076	only	-	Sep	 6	 2:00	0	-
Rule	Morocco	2077	only	-	Jul	18	 3:00	-1:00	-
Rule	Morocco	2077	only	-	Aug	22	 2:00	0	-
Rule	Morocco	2078	only	-	Jul	10	 3:00	-1:00	-
Rule	Morocco	2078	only	-	Aug	14	 2:00	0	-
Rule	Morocco	2079	only	-	Jun	25	 3:00	-1:00	-
Rule	Morocco	2079	only	-	Jul	30	 2:00	0	-
Rule	Morocco	2080	only	-	Jun	16	 3:00	-1:00	-
Rule	Morocco	2080	only	-	Jul	21	 2:00	0	-
Rule	Morocco	2081	only	-	Jun	 1	 3:00	-1:00	-
Rule	Morocco	2081	only	-	Jul	13	 2:00	0	-
Rule	Morocco	2082	only	-	May	24	 3:00	-1:00	-
Rule	Morocco	2082	only	-	Jun	28	 2:00	0	-
Rule	Morocco	2083	only	-	May	16	 3:00	-1:00	-
Rule	Morocco	2083	only	-	Jun	20	 2:00	0	-
Rule	Morocco	2084	only	-	Apr	30	 3:00	-1:00	-
Rule	Morocco	2084	only	-	Jun	11	 2:00	0	-
Rule	Morocco	2085	only	-	Apr	22	 3:00	-1:00	-
Rule	Morocco	2085	only	-	May	27	 2:00	0	-
Rule	Morocco	2086	only	-	Apr	14	 3:00	-1:00	-
Rule	Morocco	2086	only	-	May	19	 2:00	0	-
Rule	Morocco	2087	only	-	Mar	30	 3:00	-1:00	-
Rule	Morocco	2087	only	-	May	 4	 2:00	0	-

It seems that the rules are not regular, so they are defined every year. Let's read the part from 2017 onwards to the present.

Rule	Morocco	2013	2018	-	Oct	lastSun	 3:00	0	-
Rule	Morocco	2014	2018	-	Mar	lastSun	 2:00	1:00	-
(Abbreviation)
Rule	Morocco	2017	only	-	May	21	 3:00	0	-
Rule	Morocco	2017	only	-	Jul	 2	 2:00	1:00	-
Rule	Morocco	2018	only	-	May	13	 3:00	0	-
Rule	Morocco	2018	only	-	Jun	17	 2:00	1:00	-
Rule	Morocco	2019	only	-	May	 5	 3:00	-1:00	-
Rule	Morocco	2019	only	-	Jun	 9	 2:00	0	-

From 2013 to 2018, the rules of "Morocco" seem to define standard time from 3 o'clock on the last Sunday of October. From 2014 to 2018, it seems that one hour will be added from standard time from 2:00 on the last Sunday of March. In 2017, it seems that standard time is defined from 3:00 on May 21st. In 2017, it seems that one hour will be added at standard time from 2:00 on July 2nd. In 2018, it seems that standard time is defined from 3:00 on May 13th. In 2018, it seems that one hour will be added at standard time from 2:00 on June 17th. In 2019, it seems that one hour will be subtracted from standard time from 3:00 on May 5th. In 2019, it seems that standard time will be defined from 2:00 on June 9th.

I'll also re-paste the above Zone definition that applies after 2016.

# Zone	NAME		STDOFF	RULES	FORMAT	[UNTIL]
Zone Africa/Casablanca	 (Abbreviation)
                         (Abbreviation)
			 0:00	Morocco	+00/+01	2018 Oct 28  3:00
			 1:00	Morocco	+01/+00

Considering this information, it seems that 2017-2019 will be the following transition.

Definition of UTC + 0 # Zone in standard time until 3:00 on October 28, 2018 Since it will be standard time from 3:00 on the last Sunday of October 2016, it will change to UTC + 0 # Start standard time Since it will be +1 standard time from 2 o'clock on the last Sunday of March 2017, it will change to UTC + 1 # Summer time start Since it will be standard time from 3 o'clock on May 21, 2017, it will change to UTC + 0 # Ramadan start Since it will be +1 standard time from 2 o'clock on July 2, 2017, it will change to UTC + 1 # Ramadan end Since it will be standard time from 3:00 on the last Sunday of October 2017, it will change to UTC + 0 # Start standard time Since it will be +1 standard time from 2 o'clock on the last Sunday of March 2018, it will change to UTC + 1 # Summer time start Since it will be standard time from 3 o'clock on May 13, 2018, it will change to UTC + 0 # Ramadan start Since it will be +1 standard time from 2 o'clock on June 17, 2018, it will change to UTC + 1 # Ramadan end Changed standard time to UTC + 1 from 3:00 on October 28, 2018 #Definition of Zone Since it will be standard time from 3 o'clock on the last Sunday (10/28) of October 2018, continue with UTC + 1 # Daylight saving time continues Since it will be -1 standard time from 3 o'clock on May 5, 2019, it will change to UTC + 0 # Ramadan start It will change to UTC + 1 because it will be standard time from 2 o'clock on June 9, 2019 # Ramadan end

Summary

This concludes the guidance and implementation procedure for the tz database.

Release notes for the tz database can be found in the NEWS file. By reading this regularly, you can keep track of how time zones are changing in the world.

If you are interested in tz database, please read the NEWS file and time zone information of various regions.

Recommended Posts

Read tz database
Read file
Read pid.h