list of time zones

97 views
Skip to first unread message

mai...@gmail.com

unread,
Jul 25, 2016, 1:50:25 PM7/25/16
to web2py-users
How can I  present to user a list of available timezons for him to choose from, in a web2py application.
nothing to do with user's own time zone or server's time zone.
Basically I could create a table with all time zones (found on wikipidia) and populate a listbox to choose from.
Is there a better way using a python library ?
Thanks in advance

Dave S

unread,
Jul 25, 2016, 2:24:37 PM7/25/16
to web2py-users

The tzinfo class of datetime has this reference
<URL:https://pypi.python.org/pypi/pytz/>

and a reference to the Totally Official List:
<URL:http://www.iana.org/time-zones>
 
Some people recommend showing the offset from UTC, because of ambiguities in timezone names, although some of those ambiguities aren't a problem if you have additional context (e.g., an example city:  "EST (New York City)".)

See also the discussion under tzinfo.tzname()
<URL:https://docs.python.org/2/library/datetime.html#tzinfo-objects>

/dps



icodk

unread,
Jul 25, 2016, 5:02:22 PM7/25/16
to web2py-users
Thanks for the tips

Niphlod

unread,
Jul 26, 2016, 10:07:59 AM7/26/16
to web2py-users
this does it too (see docs relevant on tz_nice_detector_widget)

icodk

unread,
Jul 26, 2016, 1:54:39 PM7/26/16
to web2py-users
Thanks Niphold. This plugin is one of the best I know. It  solves timezone problem  between user browser and server. In my case it is not needed because the browser's timezone is not relevant. Let's say I have a temp sensor in Japan that reports temp to a  database in the US. The user should configure the database so when a temp reading from that sensor comes in the actual sensor's local time is a according  to the Japanese local time. So  the user that is configuring the sensor doing it from Europe, its European time zone is not relevant. The user just have to select the Japanese time zone from a list when she configures the sensor information. That list of time zones I was asking for.


On Monday, July 25, 2016 at 7:50:25 PM UTC+2, mai...@gmail.com wrote:

Niphlod

unread,
Jul 28, 2016, 10:23:06 AM7/28/16
to web2py-users
and that usecase should be covered by enabling the dropdown WITHOUT turning the autodetection.
Reply all
Reply to author
Forward
0 new messages