• Home
Name Date Size #Lines LOC

..--

README.mdD12-May-20242.5 KiB5643

map_data.txtD12-May-202483.2 KiB3,2733,267

README.md

1# Timezone Mapper
2
3The timezone mapper allows a likely timezone to be obtained for a given phone
4number. The timezone returned is the canonical ID from [CLDR](
5http://www.unicode.org/cldr/charts/latest/supplemental/zone_tzid.html), not a
6localised name (or any other identifier). For mobile phones which are associated
7with particular area codes, it returns the timezone of the area code; it does
8not track the user's current location in any way. This could be used to work out
9whether it is likely to be a good time to ring a user based on their provided
10number.
11
12Code Location:
13[java/geocoder/src/com/google/i18n/phonenumbers/PhoneNumberToTimeZonesMapper.java](https://github.com/google/libphonenumber/blob/master/java/geocoder/src/com/google/i18n/phonenumbers/PhoneNumberToTimeZonesMapper.java)
14
15Example usage:
16
17```
18PhoneNumberToTimeZonesMapper timeZonesMapper = PhoneNumberToTimeZonesMapper.getInstance();
19
20List<String> timezones = timeZonesMapper.getTimeZonesForNumber(phoneNumber);
21```
22
23## Contributing to the timezone metadata
24
25The timezone metadata is auto-generated with few exceptions, so we cannot accept
26pull requests. If we have an error please file an issue and we'll see if we can
27make a generic fix.
28
29If making fixes in your own fork while you wait for this, build the metadata by
30running this command from the root of the repository (assuming you have `ant`
31installed):
32
33```
34ant -f java/build.xml build-timezones-data
35```
36
37Note that, due to our using stable CLDR timezone IDs, we do not change the ID
38for an existing timezone when the name of a region or subdivision changes. The
39library returns the *ID*, which you may use to get the localised name from CLDR.
40
41See CLDR's [documentation for timezone
42translations](http://cldr.unicode.org/translation/timezones). You can also
43browse [different languages'
44names](http://www.unicode.org/cldr/charts/latest/verify/zones/index.html); for
45example, the `Asia/Calcutta` timezone identifier has English names
46`Kolkata Time` and `India Standard Time`, and the [English
47file](http://www.unicode.org/cldr/charts/latest/verify/zones/en.html) links to
48a [view](http://st.unicode.org/cldr-apps/v#/en/SAsia/2dac3ef061238996) with
49other regions having the same timezone (including those with different IDs).
50
51Other relevant CLDR data:
52*   http://www.unicode.org/cldr/charts/latest/supplemental/zone_tzid.html
53*   http://unicode.org/repos/cldr/trunk/common/bcp47/timezone.xml
54*   http://unicode.org/repos/cldr/trunk/common/supplemental/metaZones.xml
55*   http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml
56