OverviewA time zone is a system that is used for relating local times in different geographical areas to one another. For example, in the United States, Pacific Time is three hours earlier than Eastern Time; when it's 6 P.M. in San Francisco, it's 9 P.M. in Brooklyn. To make things simple, instead of relating time zones to one another, all time zones are related to a common reference point. For historical reasons, the reference point is Greenwich, England. Local time in Greenwich is referred to as Greenwich Mean Time, or GMT. (This is similar, but not precisely identical, to Universal Coordinated Time, or UTC. We use the two terms interchangeably in ICU since ICU does not concern itself with either leap seconds or historical behavior.) Using this system, Pacific Time is expressed as GMT-8:00, or GMT-7:00 in the summer. The offset -8:00 indicates that Pacific Time is obtained from GMT by adding -8:00, that is, by subtracting 8 hours. The offset differs in the summer because of daylight savings time, or DST. At this point it is useful to define three different flavors of local time:
Time Zones in ICUICU supports time zones through two classes:
Timezone classes are related to UDate, the Calendar classes, and the DateFormat classes. Timezone Class in ICUTimeZone is an abstract base class. It defines common protocol for a hierarchy of classes. This protocol includes:
Factory Methods and the Default TimezoneThe TimeZone factory method createTimeZone() creates and returns a TimeZone object given a programmatic ID. The user does not know what the class of the returned object is, other than that it is a subclass of TimeZone. The createAvailableIDs() methods return lists of the programmatic IDs of all zones known to the system. These IDs may then be passed to createTimeZone() to create the actual time zone objects. ICU maintains a comprehensive list of current international time zones, as derived from the Olson data. TimeZone maintains a static time zone object known as the default time zone. This is the time zone that is used implicitly when the user does not specify one. ICU attempts to match this to the host OS time zone. The user may obtain a clone of the default time zone by calling createDefault() and may change the default time zone by calling setDefault() or adoptDefault(). Display NameWhen displaying the name of a time zone to the user, use the display name, not the programmatic ID. The display name is returned by the getDisplayName() method. A time zone may have three display names:
Furthermore, each of these names may be LONG or SHORT. The SHORT form is typically an abbreviation, e.g., "PST", "PDT". In addition to being available directly from the TimeZone API, the display name is used by the date format classes to format and parse time zones. getOffset() APITimeZone defines the API getOffset() by which the caller can determine the difference between local time and GMT. This is a pure virtual API, so it is implemented in the concrete subclasses of TimeZone. Updating the Time Zone DataTime zone data changes often in response to governments around the world changing their local rules and the areas where they apply. The ICU time zone data is updated for each release, and the easiest way to stay up to date may be to upgrade to the latest ICU release, which also provides bug fixes, code improvements and additional features. If an ICU upgrade is not practical, then an old ICU installation needs to be updated. As with other systems (and very similar to with currency changes), it is only possible to update a system either after the new rules are already in effect, or if the system supports historical time zones, that is, for a given time zone ID it supports different rules for different years. For example, if a system is updated in 2006 with time zone data that includes the 2007 changes to US daylight savings time rules, then it needs to apply the old rules in 2006 and earlier years and the new rules in 2007 and later. Please use the following table to figure out whether time zone data can be updated for the version of ICU that you are using.
The time zone data in ICU is generated from the industry-standard TZ database using the tzcode (http://source.icu-project.org/repos/icu/icu/trunk/source/tools/tzcode/ ) tool. The ICU data files with recent time zone data can be downloaded from the update URL, http://source.icu-project.org/repos/icu/data/trunk/tzdata/icu/ . Update the time zone data for ICU4CIf the ICU-using application sets an ICU data path (or can be changed to set one), then the time zone .res file can be placed there. (It needs to have the proper platform endianness.) Otherwise, if the ICU data is installed as a .dat package file, the .res file can be integrated using the new icupkg tool. Otherwise - if the data is packaged into a DLL and the data path is not set - the .txt source data file can be used to rebuild the data DLL.
1. Download ICU4C binaries for latest release of from http://www.icu-project.org/download/ . 2. Unzip the binaries and set up environment variables. Unix
Windows
3. Download the appropriate time zone data resource file(s) from http://source.icu-project.org/repos/icu/data/trunk/tzdata/icu/ . Each directory contains the ICU time zone data for the tzdata version, e.g.: data for tzdata version 2008e is in directory named “2008e”. Now traverse to the directory under version directory that is appropriate to your system, e.g.: download http://source.icu-project.org/repos/icu/data/trunk/tzdata/icu/2008e/le/zoneinfo.res for little endian systems, http://source.icu-project.org/repos/icu/data/trunk/tzdata/icu/2008e/be/zoneinfo.res for big endian systems and http://source.icu-project.org/repos/icu/data/trunk/tzdata/icu/2008e/ee/zoneinfo.res for EBCIDIC systems. For ICU4C 3.8.1 or later releases, you will also need metazoneInfo.res in the same directory if exists. Additionally for tzdata version 2009p and greater when updating ICU 3.8.1 and later releases, you will also need the supplied versions of supplementalData.res in subdirectories off the main zoneinfo.res directory if they exist, eg: http://source.icu-project.org/repos/icu/data/trunk/tzdata/icu/2009p/be/38/supplementalData.res for ICU3.8.1, http://source.icu-project.org/repos/icu/data/trunk/tzdata/icu/2009p/be/40/supplementalData.res for ICU 4.0 and http://source.icu-project.org/repos/icu/data/trunk/tzdata/icu/2009p/be/42/supplementalData.res for ICU 4.2.1. 4. Replace the resource zoneinfo.res in icudt38l.dat with the downloaded version.
5. Replace the resource metazoneInfo.res in icudt38l.dat with the downloaded version. (ICU4C 3.8.1 or later releases only)
| |||||||||||||||||||||
icupkg -a supplementalData.res icudt38l.dat |
mkdir ~/work |
Windows
mkdir c:\work |
2. Download the appropriate time zone data resource file(s) from http://source.icu-project.org/repos/icu/data/trunk/tzdata/icu/ . Each directory contains the ICU time zone data for the tzdata version, e.g.: data for tzdata version 2008e is in directory named “2008e”. Note that ICU4J can only load big endian version of the resource files. Now traverse to the directory under version directory that is appropriate to ICU4J, e.g.: download http://source.icu-project.org/repos/icu/data/trunk/tzdata/icu/2008e/be/zoneinfo.res for 2008e version. For ICU4J 3.8.1 or later releases, you will also need metazoneInfo.res in the same directory if exists.
3. Replace the zoneinfo.res file in com/ibm/icu/impl/data/icudt<icu_version>b/ directory with the downloaded zoneinfo.res. For ICU4J 3.8.1 or later release, replace metazoneInfo.res in the same directory with the downloaded version.
4. Replace the resource zoneinfo.res in icu4j.jar with the downloaded version.
Unix
jar uvf icu4j.jar com/ibm/icu/impl/data/icudt38b/zoneinfo.res |
Windows
jar uvf icu4j.jar com\ibm\icu\impl\data\icudt38b\zoneinfo.res |
5. Replace the resource metazoneInfo.res in icu4j.jar with the downloaded verson. (ICU4J 3.8.1 or later releases only)
Unix
jar uvf icu4j.jar com/ibm/icu/impl/data/icudt38b/metazoneInfo.res |
Windows
jar uvf icu4j.jar com\ibm\icu\impl\data\icudt38b\metazoneInfo.res |
6. Replace the resource supplementalData.res in icu4j.jar with the properly downloaded verson based on the version of the ICU4J jar being updated. (ICU4J 3.8.1 or later releases only)
Unix
jar uvf icu4j.jar com/ibm/icu/impl/data/icudt38b/supplementalData.res
Windows
jar uvf icu4j.jar com\ibm\icu\impl\data\icudt38b\supplementalData.res
jar uvf icu4j.jar com/ibm/icu/impl/data/icudt38b/supplementalData.res
jar uvf icu4j.jar com\ibm\icu\impl\data\icudt38b\supplementalData.res