forked from daviddrysdale/python-phonenumbers
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphonenumbers.timezone.html
More file actions
65 lines (62 loc) · 4.64 KB
/
Copy pathphonenumbers.timezone.html
File metadata and controls
65 lines (62 loc) · 4.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module phonenumbers.timezone</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="phonenumbers.html"><font color="#ffffff">phonenumbers</font></a>.timezone</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="https://github.com/daviddrysdale/python-phonenumbers/blob/dev/python/phonenumbers/timezone.py">phonenumbers/timezone.py</a></font></td></tr></table>
<p><tt>Phone number to time zone mapping functionality<br>
<br>
>>> import phonenumbers<br>
>>> from phonenumbers.timezone import time_zones_for_number<br>
>>> ro_number = phonenumbers.parse("+40721234567", "RO")<br>
>>> tzlist = <a href="#-time_zones_for_number">time_zones_for_number</a>(ro_number)<br>
>>> len(tzlist)<br>
1<br>
>>> str(tzlist[0])<br>
'Europe/Bucharest'<br>
>>> dual_number = phonenumbers.parse("+976136234567", "US")<br>
>>> tzlist = <a href="#-time_zones_for_number">time_zones_for_number</a>(dual_number)<br>
>>> len(tzlist)<br>
2<br>
>>> str(tzlist[0])<br>
'Asia/Choibalsan'<br>
>>> str(tzlist[1])<br>
'Asia/Ulaanbaatar'</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt><a name="-time_zones_for_geographical_number"><strong>time_zones_for_geographical_number</strong></a>(numobj)</dt><dd><tt>Returns a list of time zones to which a phone number belongs.<br>
<br>
This method assumes the validity of the number passed in has already been<br>
checked, and that the number is geo-localizable. We consider fixed-line<br>
and mobile numbers possible candidates for geo-localization.<br>
<br>
Arguments:<br>
numobj -- a valid phone number for which we want to get the time zones<br>
to which it belongs<br>
Returns a list of the corresponding time zones or a single element list<br>
with the default unknown time zone if no other time zone was found or if<br>
the number was invalid</tt></dd></dl>
<dl><dt><a name="-time_zones_for_number"><strong>time_zones_for_number</strong></a>(numobj)</dt><dd><tt>As <a href="#-time_zones_for_geographical_number">time_zones_for_geographical_number</a>() but explicitly checks the<br>
validity of the number passed in.<br>
<br>
Arguments:<br>
numobj -- a valid phone number for which we want to get the time zones to which it belongs<br>
Returns a list of the corresponding time zones or a single element list with the default<br>
unknown time zone if no other time zone was found or if the number was invalid</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>UNKNOWN_TIMEZONE</strong> = 'Etc/Unknown'<br>
<strong>__all__</strong> = ['UNKNOWN_TIMEZONE', 'time_zones_for_geographical_number', 'time_zones_for_number']</td></tr></table>
</body></html>