11767c5feSopenharmony_ci# Timezone Mapper
21767c5feSopenharmony_ci
31767c5feSopenharmony_ciThe timezone mapper allows a likely timezone to be obtained for a given phone
41767c5feSopenharmony_cinumber. The timezone returned is the canonical ID from [CLDR](
51767c5feSopenharmony_cihttp://www.unicode.org/cldr/charts/latest/supplemental/zone_tzid.html), not a
61767c5feSopenharmony_cilocalised name (or any other identifier). For mobile phones which are associated
71767c5feSopenharmony_ciwith particular area codes, it returns the timezone of the area code; it does
81767c5feSopenharmony_cinot track the user's current location in any way. This could be used to work out
91767c5feSopenharmony_ciwhether it is likely to be a good time to ring a user based on their provided
101767c5feSopenharmony_cinumber.
111767c5feSopenharmony_ci
121767c5feSopenharmony_ciCode Location:
131767c5feSopenharmony_ci[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)
141767c5feSopenharmony_ci
151767c5feSopenharmony_ciExample usage:
161767c5feSopenharmony_ci
171767c5feSopenharmony_ci```
181767c5feSopenharmony_ciPhoneNumberToTimeZonesMapper timeZonesMapper = PhoneNumberToTimeZonesMapper.getInstance();
191767c5feSopenharmony_ci
201767c5feSopenharmony_ciList<String> timezones = timeZonesMapper.getTimeZonesForNumber(phoneNumber);
211767c5feSopenharmony_ci```
221767c5feSopenharmony_ci
231767c5feSopenharmony_ci## Contributing to the timezone metadata
241767c5feSopenharmony_ci
251767c5feSopenharmony_ciThe timezone metadata is auto-generated with few exceptions, so we cannot accept
261767c5feSopenharmony_cipull requests. If we have an error please file an issue and we'll see if we can
271767c5feSopenharmony_cimake a generic fix.
281767c5feSopenharmony_ci
291767c5feSopenharmony_ciIf making fixes in your own fork while you wait for this, build the metadata by
301767c5feSopenharmony_cirunning this command from the root of the repository (assuming you have `ant`
311767c5feSopenharmony_ciinstalled):
321767c5feSopenharmony_ci
331767c5feSopenharmony_ci```
341767c5feSopenharmony_ciant -f java/build.xml build-timezones-data
351767c5feSopenharmony_ci```
361767c5feSopenharmony_ci
371767c5feSopenharmony_ciNote that, due to our using stable CLDR timezone IDs, we do not change the ID
381767c5feSopenharmony_cifor an existing timezone when the name of a region or subdivision changes. The
391767c5feSopenharmony_cilibrary returns the *ID*, which you may use to get the localised name from CLDR.
401767c5feSopenharmony_ci
411767c5feSopenharmony_ciSee CLDR's [documentation for timezone
421767c5feSopenharmony_citranslations](http://cldr.unicode.org/translation/timezones). You can also
431767c5feSopenharmony_cibrowse [different languages'
441767c5feSopenharmony_cinames](http://www.unicode.org/cldr/charts/latest/verify/zones/index.html); for
451767c5feSopenharmony_ciexample, the `Asia/Calcutta` timezone identifier has English names
461767c5feSopenharmony_ci`Kolkata Time` and `India Standard Time`, and the [English
471767c5feSopenharmony_cifile](http://www.unicode.org/cldr/charts/latest/verify/zones/en.html) links to
481767c5feSopenharmony_cia [view](http://st.unicode.org/cldr-apps/v#/en/SAsia/2dac3ef061238996) with
491767c5feSopenharmony_ciother regions having the same timezone (including those with different IDs).
501767c5feSopenharmony_ci
511767c5feSopenharmony_ciOther relevant CLDR data:
521767c5feSopenharmony_ci*   http://www.unicode.org/cldr/charts/latest/supplemental/zone_tzid.html
531767c5feSopenharmony_ci*   http://unicode.org/repos/cldr/trunk/common/bcp47/timezone.xml
541767c5feSopenharmony_ci*   http://unicode.org/repos/cldr/trunk/common/supplemental/metaZones.xml
551767c5feSopenharmony_ci*   http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml
56