phonenumbers.timezone | index phonenumbers/timezone.py

`Phone number to time zone mapping functionality
>>> import phonenumbers
>>> from phonenumbers.timezone import time_zones_for_number
>>> ro_number = phonenumbers.parse("+40721234567", "RO")
>>> tzlist = time_zones_for_number(ro_number)
>>> len(tzlist)
1
>>> str(tzlist[0])
'Europe/Bucharest'
>>> dual_number = phonenumbers.parse("+976136234567", "US")
>>> tzlist = time_zones_for_number(dual_number)
>>> len(tzlist)
2
>>> str(tzlist[0])
'Asia/Choibalsan'
>>> str(tzlist[1])
'Asia/Ulaanbaatar'`

Functions
`` |  | time_zones_for_geographical_number(numobj) `Returns a list of time zones to which a phone number belongs. This method assumes the validity of the number passed in has already been checked, and that the number is geo-localizable. We consider fixed-line and mobile numbers possible candidates for geo-localization. Arguments: numobj -- a valid phone number for which we want to get the time zones to which it belongs Returns a list of the corresponding time zones or a single element list with the default unknown time zone if no other time zone was found or if the number was invalid` time_zones_for_number(numobj) `As time_zones_for_geographical_number() but explicitly checks the validity of the number passed in. Arguments: numobj -- a valid phone number for which we want to get the time zones to which it belongs Returns a list of the corresponding time zones or a single element list with the default unknown time zone if no other time zone was found or if the number was invalid`

Data
`` |  | UNKNOWN_TIMEZONE = 'Etc/Unknown' __all__ = ['UNKNOWN_TIMEZONE', 'time_zones_for_geographical_number', 'time_zones_for_number']