tz
database
The public-domain
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
boundaries, UTC offsets, and
daylight-saving
rules.
This database (often called zoneinfo
or
tz
)
is used by several implementations,
including
the
GNU
C Library (used in
GNU/Linux),
Android,
Firefox
OS,
FreeBSD,
NetBSD,
OpenBSD,
Cygwin,
DJGPP,
Symbian,
webOS,
AIX,
BlackBerry 10,
iOS,
OpenVMS,
Oracle Database,
OS
X, and
Solaris.
Each location in the database represents a national 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.
For example, America/New_York
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 TZ
environment variable to the location's full name,
e.g., TZ="America/New_York"
.
In the tz
database's
FTP releases
the code is in the file tzcodeC.tar.gz
,
where C
is the code's version;
similarly, the data are in tzdataD.tar.gz
,
where D
is the data's 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).
Convenience links to
the latest
code and
latest data revisions
are also available.
The following shell commands download
these files to a GNU/Linux or similar host;
see the downloaded
README
file for what to do next.
mkdir tz
cd tz
wget --retr-symlinks 'ftp://ftp.iana.org/tz/tz*-latest.tar.gz'
gzip -dc tzcode-latest.tar.gz | tar -xf -
gzip -dc tzdata-latest.tar.gz | tar -xf -
The code and data files can also be obtained from the Time Zone Database website of the Internet Assigned Numbers Authority (IANA). An unofficial development repository of the code and data is available in Git form from GitHub; be careful, as this repository is less well tested and probably contains more errors.
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
location.
The data are by no means authoritative. If you find errors, please send changes to the time zone mailing list. You can also browse recent messages sent to the mailing list, subscribe to it, and browse the archive of old messages. For further information about updates, please see Procedures for Maintaining the Time Zone Database (Internet RFC 6557).
The Web has several other sources for time zone and daylight saving time data. Here are some links that may be of interest.
tz
databasetz
database format.tz
databaseThese are listed roughly in ascending order of complexity and fanciness.
TZ
values directly.tz
.tz
zone, along with a polygonal
representation of the geographical area corresponding to the
zone.tz
. An earlier schema was sketched out.tz
compilerstz
source into iCalendar-compatible VTIMEZONE files.
Vzic is freely
available under the GNU
General Public License (GPL).parse_olson
that compiles
tz
source 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_zdump
that generates test cases for each clock
transition in the tz
database.tz
source
and from CLDR data
(mentioned below)
into an ICU-specific format.
ICU is freely available under a
BSD-style license.org.joda.time.tz.ZoneInfoCompiler
that compiles
tz
source into a Joda-specific binary format. Joda Time
is freely available under a BSD-style license.tz
source files and interprets time
stamps using an API that is upward compatible with standard JavaScript
Dates. It is freely available under the Apache License.tz
source into
Python.
It is freely available under a BSD-style license.tz
source into
Ruby.
It is freely available under the MIT license.tz
source into a time
zone repository whose format
is either proprietary or an XML-encoded
representation.tz
source into text files, along with a runtime that can read those
files. Tcl is freely available under a BSD-style
license.tz
binary file readerstz
binary file reader.
This library is freely available under the
GNU Lesser General Public License
(LGPL),
and is widely used in GNU/Linux systems.tz
binary file reader written in C that
creates a GTimeZone
object representing sets of UTC offsets.
It is freely available under the LGPL.tz
binary file reader written in Java.
It is freely available under the LGPL.tz
binary file reader.tz
binary file reader written in Perl.
It is freely available under the same terms as Perl
(dual GPL and Artistic license).tz
binary data into
JSON-format data suitable for use
in its JavaScript library for time zone conversion. Dates before 1970
are not supported.tz
binary data.tz
-based time zone softwaretz
database in a
Java-specific format.tzdataD.tar.gz
files as they are released. The Basic version is free.tz
contributors.usno*
files in
the tz
distribution.TZ
values using the Zone
→ Tzid table in the CLDR data mentioned
below, or via Windows
Store apps classes such as DateTimeFormatter.tz
regions.tz
database contains English abbreviations for all time stamps but in
many cases these are merely inventions of the database
maintainers.+09
for Japan and
-10
for Hawaii. However, the POSIX
TZ
environment variable uses the opposite convention.
For example, one might use TZ="JST-9"
and
TZ="HST10"
for Japan and Hawaii, respectively. If the
tz
database is available, it is usually better to use
settings like TZ="Asia/Tokyo"
and
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 TZ
to a value like
"GMT-9"
, though, since this would falsely claim that
local time is nine hours ahead of UTC and the time zone
is called "GMT".