KVISH
KVISH

Reputation: 13178

timezone support in django

I'm trying to get the various US timezones supported in Django. I'm able to get the America/New_York, etc. But my question is for places like Hawaii? I'm not able to find the proper timezone setting for it? Is there a place for all the available settings that we can use in Django? I want to build an application and give the user the ability to choose the timezone they are in.. Thanks for the help!

Upvotes: 0

Views: 609

Answers (1)

Paulo Scardine
Paulo Scardine

Reputation: 77251

See "What you need to know about date/time" (nice video from PyCon 2012).

>>> import pytz
>>> pytz.all_timezones
['Africa/Abidjan',
'Africa/Accra',
'Africa/Addis_Ababa'
...
'US/Pacific-New',
'US/Samoa',
'UTC',
'Universal',
'W-SU',
'WET',
'Zulu']

Data available:

all_timezones = ['Africa/Abidjan', 'Africa/Accra', ...]
all_timezones_set = set(['Africa/Abidjan', 'Africa/Accra', ...]
common_timezones = ['Africa/Abidjan', 'Africa/Accra', ...]
common_timezones_set = set(['Africa/Abidjan', 'Africa/Accra', ...])
country_names = {u'BD': u'Bangladesh', u'BE': u'Belgium', ...}
country_timezones = {u'BD': [u'Asia/Dhaka'], u'BE': [u'Europe/Brussels'] ...}

Upvotes: 1

Related Questions