Time zone and daylight saving rules are controlled by individual governments. They are sometimes changed with little notice, and their histories and planned futures are often recorded only fitfully. Here is a summary of attempts to organize and record relevant data in this area.
time zone database contains code and data
that represent the history of local time
for many representative locations around the globe.
It is updated periodically to reflect changes made by political bodies
to time zone
This database (often called
is used by several implementations,
C Library (used in
Oracle Database, and
Each location in the database represents a region where all
clocks keeping local time have agreed since 1970.
Locations are identified by continent or ocean and then by the name of
the location, which is typically the largest city within the region.
represents most of the US eastern time zone;
America/Phoenix represents most of Arizona, which
uses mountain time without daylight saving time (DST);
America/Detroit represents most of Michigan, which uses
eastern time but with different DST rules in 1975;
and other entries represent smaller regions like Starke County,
Indiana, which switched from central to eastern time in 1991
and switched back in 2006.
To use the database on an extended POSIX
implementation set the
environment variable to the location's full name,
Associated with each region is a history of offsets from Universal Time (UT), which is Greenwich Mean Time (GMT) with days beginning at midnight; for time stamps after 1960 this is more precisely Coordinated Universal Time (UTC). The database also records when daylight saving time was in use, along with some time zone abbreviations such as EST for Eastern Standard Time in the US.
The following shell commands download the latest release's two tarballs to a GNU/Linux or similar host.
mkdir tzdb cd tzdb wget https://www.iana.org/time-zones/repository/tzcode-latest.tar.gz wget https://www.iana.org/time-zones/repository/tzdata-latest.tar.gz gzip -dc tzcode-latest.tar.gz | tar -xf - gzip -dc tzdata-latest.tar.gz | tar -xf -
Alternatively, the following shell commands download the same release in a single-tarball format containing extra data useful for regression testing:
wget https://www.iana.org/time-zones/repository/tzdb-latest.tar.lz lzip -dc tzdb-latest.tar.lz | tar -xf -
These commands use convenience links to the latest release
tz database hosted by the
Time Zone Database website
of the Internet Assigned Numbers
Older releases are in files named
V is the version.
Since 1996, each version has been a four-digit year followed by
lower-case letter (a through z,
then za through zz, then zza
through zzz, and so on).
Since version 2016h, each release has contained a text file named
"version" whose first (and currently only) line is the version.
The releases are also available in an
FTP directory via a
less-secure protocol .
Alternatively, a development repository of code and data can be retrieved from GitHub via the shell command:
git clone https://github.com/eggert/tz
Since version 2012e, each release has been tagged in development repositories. Untagged commits are less well tested and probably contain more errors.
After obtaining the code and data files, see the
README file for what to do next.
The code lets you compile the
tz source files into
machine-readable binary files, one for each location. It also lets
you read a
tz binary file and interpret time stamps for that
tz code and data
are by no means authoritative. If you find errors, please
send changes to the time zone
mailing list. You can also subscribe to it
and browse the archive of old
If your government plans to change its time zone boundaries or daylight saving rules, let the mailing list know well in advance. With less than a year's notice there is a good chance that some computer-based clocks will operate incorrectly after the change, due to delays in propagating updates to software and data. The shorter the notice, the more likely clock problems will arise.
Sources for the
tz database are
with lines terminated by LF,
which can be modified by common text editors such
as GNU Emacs,
editor has a package to simplify editing further:
For further information about updates, please see Procedures for Maintaining the Time Zone Database (Internet RFC 6557).
These are listed roughly in ascending order of complexity and fanciness.
tzsource into iCalendar-compatible VTIMEZONE files. Vzic is freely available under the GNU General Public License (GPL).
tzsource into Perl modules. It is part of the Perl DateTime Project, which is freely available under both the GPL and the Perl Artistic License. DateTime::TimeZone also contains a script
tests_from_zdumpthat generates test cases for each clock transition in the
tzsource and from CLDR data (mentioned below) into an ICU-specific format. ICU is freely available under a BSD-style license.
tzsource into the format used by Oracle Java.
java.timeAPI can be supplemented by ThreeTen-Extra, which is freely available under a BSD-style license.
tzsource into a binary format. It inspired Java 8
java.time, which its users should migrate to once they can assume Java 8 or later. It is available under the Apache License.
tzsource into a binary format. Time4J is available under the GNU Lesser General Public License (LGPL).
tzsource into Julia. It is freely available under the MIT license.
tzsource into Python. It is freely available under a BSD-style license.
tzsource into Ruby. It is freely available under the MIT license.
tzsource into a time zone repository whose format is either proprietary or an XML-encoded representation.
tzsource into text files, along with a runtime that can read those files. Tcl is freely available under a BSD-style license.
tzbinary file readers
tzbinary file reader. This library is freely available under the LGPL and is widely used in GNU/Linux systems.
tzbinary file reader written in C that creates a
GTimeZoneobject representing sets of UT offsets. It is freely available under the LGPL.
baltzo::TimeZoneUtilcomponent contains a C++ implementation of a binary file reader. It is freely available under the Apache License.
tzbinary file reader written in Java. It is freely available under the LGPL.
tzbinary file reader.
tzbinary file reader written in Perl. It is freely available under the same terms as Perl (dual GPL and Artistic license).
tzbinary data. It is freely available under a BSD-style license.
tz-based time zone software
tzdatabase in a Go-specific format.
tzdata and CLDR data (mentioned below) used by Windows Runtime classes such as
DateTimeFormatter. Exploring Windows Time Zones with
System.TimeZoneInfodescribes the older, proprietary method of Microsoft Windows 2000 and later, which stores time zone data in the Windows Registry. The Zone → Tzid table or XML file of the CLDR data maps proprietary zone IDs to
tzdatabase in a Java-specific format.
tzreleases. The Basic version is free.
Geographical boundaries between time zone regions are available from several geolocation services and other sources.
tzregions. Its code is freely available under the MIT license, and its data entries are freely available under the Open Data Commons Open Database License. The maps' borders appear to be quite accurate.
tzregions. This includes tz_world, a shapefile for all the world's regions
tzcode and data support leap seconds via an optional "
right" configuration, as opposed to the default "
posix" configuration, is supported by the NTP reference implementation, and is used by major cloud service providers.
tzdatabase contains English abbreviations for many time stamps; unfortunately some of these abbreviations were merely the database maintainers' inventions, and are gradually being removed.
TZenvironment variable uses the opposite convention. For example, one might use
TZ="HST10"for Japan and Hawaii, respectively. If the
tzdatabase is available, it is usually better to use settings like
TZ="Pacific/Honolulu"instead, as this should avoid confusion, handle old time stamps better, and insulate you better from any future changes to the rules. One should never set POSIX
TZto a value like
"GMT-9", though, since this would incorrectly imply that local time is nine hours ahead of UTC and the time zone is called "GMT".