Login

Timezone choice field for select box

Author:
jmunro
Posted:
March 1, 2012
Language:
Python
Version:
Not specified
Score:
0 (after 0 ratings)

A simple 2-tuple list of time zones for use in a choice field or select box for Django, or wherever needed.

 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
TIME_ZONE_CHOICES = (
     ('-12.0', '(GMT -12:00) Eniwetok, Kwajalein'),
     ('-11.0', '(GMT -11:00) Midway Island, Samoa'),
     ('-10.0', '(GMT -10:00) Hawaii'),
     ('-9.0', '(GMT -9:00) Alaska'),
     ('-8.0', '(GMT -8:00) Pacific Time (US & Canada)'),
     ('-7.0', '(GMT -7:00) Mountain Time (US & Canada)'),
     ('-6.0', '(GMT -6:00) Central Time (US & Canada), Mexico City'),
     ('-5.0', '(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima'),
     ('-4.0', '(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz'),
     ('-3.5', '(GMT -3:30) Newfoundland'),
     ('-3.0', '(GMT -3:00) Brazil, Buenos Aires, Georgetown'),
     ('-2.0', '(GMT -2:00) Mid-Atlantic'),
     ('-1.0', '(GMT -1:00 hour) Azores, Cape Verde Islands'),
     ('0.0', '(GMT) Western Europe Time, London, Lisbon, Casablanca'),
     ('1.0', '(GMT +1:00 hour) Brussels, Copenhagen, Madrid, Paris'),
     ('2.0', '(GMT +2:00) Kaliningrad, South Africa'),
     ('3.0', '(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg'),
     ('3.5', '(GMT +3:30) Tehran'),
     ('4.0', '(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi'),
     ('4.5', '(GMT +4:30) Kabul'),
     ('5.0', '(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent'),
     ('5.5', '(GMT +5:30) Bombay, Calcutta, Madras, New Delhi'),
     ('5.75', '(GMT +5:45) Kathmandu'),
     ('6.0', '(GMT +6:00) Almaty, Dhaka, Colombo'),
     ('7.0', '(GMT +7:00) Bangkok, Hanoi, Jakarta'),
     ('8.0', '(GMT +8:00) Beijing, Perth, Singapore, Hong Kong'),
     ('9.0', '(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk'),
     ('9.5', '(GMT +9:30) Adelaide, Darwin'),
     ('10.0', '(GMT +10:00) Eastern Australia, Guam, Vladivostok'),
     ('11.0', '(GMT +11:00) Magadan, Solomon Islands, New Caledonia'),
     ('12.0', '(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka')
)

More like this

  1. Template tag - list punctuation for a list of items by shapiromatron 11 months, 1 week ago
  2. JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 11 months, 2 weeks ago
  3. Serializer factory with Django Rest Framework by julio 1 year, 6 months ago
  4. Image compression before saving the new model / work with JPG, PNG by Schleidens 1 year, 7 months ago
  5. Help text hyperlinks by sa2812 1 year, 7 months ago

Comments

Please login first before commenting.