Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

pytz has so many timezones!

285 views
Skip to first unread message

Sanjay

unread,
Oct 8, 2007, 3:32:19 AM10/8/07
to
Hi All,

I am using pytz.common_timezones to populate the timezone combo box of
some user registration form. But as it has so many timezones (around
400), it is a bit confusing to the users. Is there a smaller and more
practical set? If not, some suggestions on how to handle the
registration form effectively would help me a lot.

thanks
Sanjay

Diez B. Roggisch

unread,
Oct 8, 2007, 4:40:26 AM10/8/07
to
Sanjay wrote:

I'm not a timezone-guru - but I _think_ if there are 400 timezones defined,
it should list them, shouldn't it? What if you lived in the one that's not
part of the "practical subset"?

The only one who can define what that practical subset is supposed to
consist of is _you_. You know where your app is being used, from whom.

Diez

BJörn Lindqvist

unread,
Oct 8, 2007, 5:09:16 AM10/8/07
to Sanjay, pytho...@python.org

Windows timezone selector only lists about 80 timezones. But why force
the user to select timezone? Let them select from a list of countries
and then infer the timezone from that data. With multiple alternatives
for countries with more than one timezone, United States EST, United
States PST and so on.

--
mvh Björn

ga...@dsdata.it

unread,
Oct 8, 2007, 6:46:05 AM10/8/07
to
On Oct 8, 10:40 am, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
> Sanjay wrote:
> > Hi All,
>
> > I am using pytz.common_timezones to populate the timezone combo box of
> > some user registration form. But as it has so many timezones (around
> > 400), it is a bit confusing to the users. Is there a smaller and more
> > practical set? If not, some suggestions on how to handle the
> > registration form effectively would help me a lot.
>
> I'm not a timezone-guru - but I _think_ if there are 400 timezones defined,
> it should list them, shouldn't it? What if you lived in the one that's not
> part of the "practical subset"?

I think the problem is displaying a dropdown list of timezones. People
have little idea of how their timezones are called; it would be better
to list countries, which are many but nicely alphabetized, and map the
country to its only timezone, or for the few large countries with more
than a TZ offer a choice later.

Lorenzo Gatti

Sanjay

unread,
Oct 8, 2007, 9:47:28 AM10/8/07
to
> Windows timezone selector only lists about 80 timezones. But why force
> the user to select timezone? Let them select from a list of countries
> and then infer the timezone from that data. With multiple alternatives
> for countries with more than one timezone, United States EST, United
> States PST and so on.

> I think the problem is displaying a dropdown list of timezones. People


> have little idea of how their timezones are called; it would be better
> to list countries, which are many but nicely alphabetized, and map the
> country to its only timezone, or for the few large countries with more
> than a TZ offer a choice later.

Thanks for the suggestions!

1. I am unable to understand how Windows manages with only 80 whereas
pytz has 400. Understanding this can be a nice clue for my work. Any
insights?
2. Mapping the timezones to countries is a nice idea. Any idea how to
go about it - I mean whether I have to collect the data manually and
do it, or some better way is available - will help me a lot.

thanks
Sanjay

mensa...@aol.com

unread,
Oct 8, 2007, 1:41:03 PM10/8/07
to
On Oct 8, 2:32 am, Sanjay <skpate...@gmail.com> wrote:
> Hi All,
>
> I am using pytz.common_timezones to populate the timezone combo box of
> some user registration form. But as it has so many timezones (around
> 400),

There are only 25 timezones: -12, -11, ... -1, 0 (GMT), +1, ... +11,
+12.

A handful of countries set their clocks offset by a half hour,
but those aren't timezones.

And there is one country whose clock setting is the product of
a diseased mind (GMT+13), but that isn't a timezone either.

The 400 you're seeing are duplications based on locality. Of the 86
shown in Windows, all but 33 are dulplicate references to the same
timezones.

For example, Windows has seperate listings for

Central America
Central Time (US & Canada)
Guadalahara, Mexico City, Monterry - New
Guadalahara, Mexico City, Monterry - Old
Saskatchewan

but they are all GMT-6

> it is a bit confusing to the users. Is there a smaller and more
> practical set?

Filter the list by location.

J. Clifford Dyer

unread,
Oct 8, 2007, 2:00:28 PM10/8/07
to mensa...@aol.com, pytho...@python.org
On Mon, Oct 08, 2007 at 10:41:03AM -0700, mensa...@aol.com wrote regarding Re: pytz has so many timezones!:
>
> On Oct 8, 2:32 am, Sanjay <skpate...@gmail.com> wrote:
> > Hi All,
> >
> > I am using pytz.common_timezones to populate the timezone combo box of
> > some user registration form. But as it has so many timezones (around
> > 400),
>
> There are only 25 timezones: -12, -11, ... -1, 0 (GMT), +1, ... +11,
> +12.
>
> A handful of countries set their clocks offset by a half hour,
> but those aren't timezones.
>

I'm sorry. By what even vaguely useful definition of "Timezone" is it not a timezone if it's offset by half an hour?

>
> The 400 you're seeing are duplications based on locality. Of the 86
> shown in Windows, all but 33 are dulplicate references to the same
> timezones.
>
> For example, Windows has seperate listings for
>
> Central America
> Central Time (US & Canada)
> Guadalahara, Mexico City, Monterry - New
> Guadalahara, Mexico City, Monterry - Old
> Saskatchewan
>
> but they are all GMT-6
>

Those are non-duplicate (and perhaps inaccurate, I'm not sure). US time switches from standard to Daylight Savings earlier than Mexico, and switches back later, as of this year. Reducing them to a single time zone will result in aberrant functionality in one or more locales.

Cheers,
Cliff

J. Clifford Dyer

unread,
Oct 8, 2007, 2:00:28 PM10/8/07
to mensa...@aol.com, pytho...@python.org
On Mon, Oct 08, 2007 at 10:41:03AM -0700, mensa...@aol.com wrote regarding Re: pytz has so many timezones!:
>
> On Oct 8, 2:32 am, Sanjay <skpate...@gmail.com> wrote:
> > Hi All,
> >
> > I am using pytz.common_timezones to populate the timezone combo box of
> > some user registration form. But as it has so many timezones (around
> > 400),
>
> There are only 25 timezones: -12, -11, ... -1, 0 (GMT), +1, ... +11,
> +12.
>
> A handful of countries set their clocks offset by a half hour,
> but those aren't timezones.
>

I'm sorry. By what even vaguely useful definition of "Timezone" is it not a timezone if it's offset by half an hour?

>

> The 400 you're seeing are duplications based on locality. Of the 86
> shown in Windows, all but 33 are dulplicate references to the same
> timezones.
>
> For example, Windows has seperate listings for
>
> Central America
> Central Time (US & Canada)
> Guadalahara, Mexico City, Monterry - New
> Guadalahara, Mexico City, Monterry - Old
> Saskatchewan
>
> but they are all GMT-6
>

Those are non-duplicate (and perhaps inaccurate, I'm not sure). US time switches from standard to Daylight Savings earlier than Mexico, and switches back later, as of this year. Reducing them to a single time zone will result in aberrant functionality in one or more locales.

Cheers,
Cliff

Carsten Haese

unread,
Oct 8, 2007, 2:03:59 PM10/8/07
to pytho...@python.org
On Mon, 2007-10-08 at 10:41 -0700, mensa...@aol.com wrote:
> For example, Windows has seperate listings for
>
> Central America
> Central Time (US & Canada)
> Guadalahara, Mexico City, Monterry - New
> Guadalahara, Mexico City, Monterry - Old
> Saskatchewan
>
> but they are all GMT-6

But they could have different rules for Daylight Saving Time.

--
Carsten Haese
http://informixdb.sourceforge.net


andrew clarke

unread,
Oct 8, 2007, 2:31:00 PM10/8/07
to Sanjay, pytho...@python.org

Use something like:

for zone in common_timezones:
continent, region = zone.split('/')

Then have two list boxes, one for the continent and the other for the region.

[Australia ]

[Melbourne ]

('Continent' is probably not the right word.)

Regards
Andrew

mensa...@aol.com

unread,
Oct 8, 2007, 4:12:32 PM10/8/07
to
On Oct 8, 1:00 pm, "J. Clifford Dyer" <j...@sdf.lonestar.org> wrote:

> On Mon, Oct 08, 2007 at 10:41:03AM -0700, mensana...@aol.com wrote regarding Re: pytz has so many timezones!:
>
>
>
> > On Oct 8, 2:32 am, Sanjay <skpate...@gmail.com> wrote:
> > > Hi All,
>
> > > I am using pytz.common_timezones to populate the timezone combo box of
> > > some user registration form. But as it has so many timezones (around
> > > 400),
>
> > There are only 25 timezones: -12, -11, ... -1, 0 (GMT), +1, ... +11,
> > +12.
>
> > A handful of countries set their clocks offset by a half hour,
> > but those aren't timezones.
>
> I'm sorry. By what even vaguely useful definition of "Timezone" is it not a timezone if it's offset by half an hour?

The miltary doesn't recognize them as timezones. They'll make
a not that the local time observed doesn't match the timezone,
but they don't call it a seperate timezone.

>
> > The 400 you're seeing are duplications based on locality. Of the 86
> > shown in Windows, all but 33 are dulplicate references to the same
> > timezones.
>
> > For example, Windows has seperate listings for
>
> > Central America
> > Central Time (US & Canada)
> > Guadalahara, Mexico City, Monterry - New
> > Guadalahara, Mexico City, Monterry - Old
> > Saskatchewan
>
> > but they are all GMT-6
>
> Those are non-duplicate (and perhaps inaccurate, I'm not sure). US time switches from standard to Daylight Savings earlier than Mexico, and switches back later, as of this year.

Duplicate timezones doesn't mean duplicate time,
as you point out. Does the OP want to know the truth
or does he want to know something he can understand.

> Reducing them to a single time zone will result in aberrant functionality in one or more locales.

I would hardly think that's an issue on the user registration
form the OP is trying to create.

>
> Cheers,
> Cliff


mensa...@aol.com

unread,
Oct 8, 2007, 4:13:24 PM10/8/07
to
On Oct 8, 1:03 pm, Carsten Haese <cars...@uniqsys.com> wrote:

> On Mon, 2007-10-08 at 10:41 -0700, mensana...@aol.com wrote:
> > For example, Windows has seperate listings for
>
> > Central America
> > Central Time (US & Canada)
> > Guadalahara, Mexico City, Monterry - New
> > Guadalahara, Mexico City, Monterry - Old
> > Saskatchewan
>
> > but they are all GMT-6
>
> But they could have different rules for Daylight Saving Time.

Which only matters if you're setting your clock.

>
> --
> Carsten Haesehttp://informixdb.sourceforge.net


J. Clifford Dyer

unread,
Oct 8, 2007, 4:23:26 PM10/8/07
to mensa...@aol.com
On Mon, Oct 08, 2007 at 01:12:32PM -0700, mensa...@aol.com wrote regarding Re: pytz has so many timezones!:
> [ I wrote ]

> > Reducing them to a single time zone will result in aberrant functionality in one or more locales.
>
> I would hardly think that's an issue on the user registration
> form the OP is trying to create.
>

You don't think that it's an issue that the OPs users will complain about their time being inaccurate? If I register in what we in the US call Eastern Time Zone, I don't want to have to switch to Atlantic time zone just because the form designer couldn't be bothered to include a time zone that actually matched the function of the clocks in my area.

Pedantry about the definition of a time zone is not going to win you points with irate users.

Cliff

J. Clifford Dyer

unread,
Oct 8, 2007, 4:25:58 PM10/8/07
to mensa...@aol.com

Maybe this is where I'm not understanding you: Do you have another use for setting a timezone? The only thing a time zone does, as far as I can tell, is set clocks relative to a shared conception of time.


Chris Mellon

unread,
Oct 8, 2007, 4:27:01 PM10/8/07
to pytho...@python.org
On 10/8/07, mensa...@aol.com <mensa...@aol.com> wrote:
> On Oct 8, 1:00 pm, "J. Clifford Dyer" <j...@sdf.lonestar.org> wrote:
> > On Mon, Oct 08, 2007 at 10:41:03AM -0700, mensana...@aol.com wrote regarding Re: pytz has so many timezones!:
> >
> >
> >
> > > On Oct 8, 2:32 am, Sanjay <skpate...@gmail.com> wrote:
> > > > Hi All,
> >
> > > > I am using pytz.common_timezones to populate the timezone combo box of
> > > > some user registration form. But as it has so many timezones (around
> > > > 400),
> >
> > > There are only 25 timezones: -12, -11, ... -1, 0 (GMT), +1, ... +11,
> > > +12.
> >
> > > A handful of countries set their clocks offset by a half hour,
> > > but those aren't timezones.
> >
> > I'm sorry. By what even vaguely useful definition of "Timezone" is it not a timezone if it's offset by half an hour?
>
> The miltary doesn't recognize them as timezones. They'll make
> a not that the local time observed doesn't match the timezone,
> but they don't call it a seperate timezone.
>

What do you mean by "the military" and why do you think they're
authoritative on the topic of timezones? The US timekeeping authority
is a branch of the US Navy, but as far as I know they don't define
timezones.

> >
> > > The 400 you're seeing are duplications based on locality. Of the 86
> > > shown in Windows, all but 33 are dulplicate references to the same
> > > timezones.
> >
> > > For example, Windows has seperate listings for
> >
> > > Central America
> > > Central Time (US & Canada)
> > > Guadalahara, Mexico City, Monterry - New
> > > Guadalahara, Mexico City, Monterry - Old
> > > Saskatchewan
> >
> > > but they are all GMT-6
> >
> > Those are non-duplicate (and perhaps inaccurate, I'm not sure). US time switches from standard to Daylight Savings earlier than Mexico, and switches back later, as of this year.
>
> Duplicate timezones doesn't mean duplicate time,
> as you point out. Does the OP want to know the truth
> or does he want to know something he can understand.
>
> > Reducing them to a single time zone will result in aberrant functionality in one or more locales.
>
> I would hardly think that's an issue on the user registration
> form the OP is trying to create.
>

It's not clear at all from the OPs post exactly what functionality he
is trying to derive from the timezone. Since timezones (obviously)
contain more information than just the GMT offset (otherwise we
wouldn't even have them), he may very well want to use the timezone
given by the user to display correct local time to them. In this case,
the actual, correct, political timezone is important, not just the GMT
offset.

> >
> > Cheers,
> > Cliff
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Joe Holloway

unread,
Oct 8, 2007, 5:23:50 PM10/8/07
to pytho...@python.org
On 10/8/07, Sanjay <skpa...@gmail.com> wrote:
> 2. Mapping the timezones to countries is a nice idea. Any idea how to
> go about it - I mean whether I have to collect the data manually and
> do it, or some better way is available - will help me a lot.

You might find some good information by brushing up on the Olson time
zone database:

http://en.wikipedia.org/wiki/Zoneinfo
http://www.twinsun.com/tz/tz-link.htm

J. Cliff Dyer

unread,
Oct 8, 2007, 6:48:56 PM10/8/07
to python help
On 10/8/07, *J. Clifford Dyer* <j...@sdf.lonestar.org
<mailto:j...@sdf.lonestar.org>> wrote:

On Mon, Oct 08, 2007 at 01:13:24PM -0700, mensa...@aol.com

<mailto:mensa...@aol.com> wrote regarding Re: pytz has so many
timezones!:
>


> On Oct 8, 1:03 pm, Carsten Haese < cars...@uniqsys.com

<mailto:cars...@uniqsys.com>> wrote:
> > On Mon, 2007-10-08 at 10:41 -0700, mensana...@aol.com

<mailto:mensana...@aol.com> wrote:
> > > For example, Windows has seperate listings for
> >
> > > Central America
> > > Central Time (US & Canada)
> > > Guadalahara, Mexico City, Monterry - New
> > > Guadalahara, Mexico City, Monterry - Old
> > > Saskatchewan
> >
> > > but they are all GMT-6
> >
> > But they could have different rules for Daylight Saving Time.
>
> Which only matters if you're setting your clock.
>

Maybe this is where I'm not understanding you: Do you have another


use for setting a timezone? The only thing a time zone does, as far
as I can tell, is set clocks relative to a shared conception of time.


--
http://mail.python.org/mailman/listinfo/python-list

> How about a calendar entry: I've got six people in places all over the
> world to get on the phone together. If the app doesn't know their
> notion of a time zone, that will never happen.
>
> How about financial transactions: time-stamping transactions that move
> around the world seems pretty useful to me. How do I know when said
> transaction started if I can't convert the user's time into the
> server's time?
>
> Timezone is just another localization setting. It is no different
> than language or keyboard layout. It is a piece of data that
> describes the "world" the user lives in. Unfortunately, DST makes
> them very complex because DST is determined by the country and can
> change from year to year. I think the US' DST change this year had
> more of a real-world impact than Y2K (of course, people actually
> planned for Y2K, but that is a different story :).
>
> tj
>


OK. Those all make sense, but I think they contradict mensanator's
statement that DST and half-hour offsets "only matter[] if you're
setting your clock." None of those are meaningful with 25 generic time
zones, which was what I was trying to understand. Under what normal
circumstances (outside of the US military creating an approximation for
their own internal usage) could 25 tzs be a useful abstraction?

Cheers,
Cliff

mensa...@aol.com

unread,
Oct 8, 2007, 8:41:47 PM10/8/07
to
On Oct 8, 5:48 pm, "J. Cliff Dyer" <j...@sdf.lonestar.org> wrote:
> On 10/8/07, *J. Clifford Dyer* <j...@sdf.lonestar.org
>
> <mailto:j...@sdf.lonestar.org>> wrote:
>
> On Mon, Oct 08, 2007 at 01:13:24PM -0700, mensana...@aol.com
> <mailto:mensana...@aol.com> wrote regarding Re: pytz has so many

It's how the world goes around.

Some people can't see the forest for the trees.

Is it obvious from all this timezone crap that

- a day lasts 48 hours?

- it can never be the same day everywhere in the world
simultaneously?

Isn't that just as important for worldwide transactions
as Daylight Savings Time (or lack thereof)?

Perhaps, once the basics
<http://members.aol.com/rotanasnem/truth/eykw_t40.htm>
are understood, the details won't be so confusing.

>
> Cheers,
> Cliff

mensa...@aol.com

unread,
Oct 8, 2007, 8:49:14 PM10/8/07
to
On Oct 8, 3:23 pm, "J. Clifford Dyer" <j...@sdf.lonestar.org> wrote:

> On Mon, Oct 08, 2007 at 01:12:32PM -0700, mensana...@aol.com wrote regarding Re: pytz has so many timezones!:
>
> > [ I wrote ]
> > > Reducing them to a single time zone will result in aberrant functionality in one or more locales.
>
> > I would hardly think that's an issue on the user registration
> > form the OP is trying to create.
>
> You don't think that it's an issue that the OPs users will complain about their time being inaccurate? If I register in what we in the US call Eastern Time Zone, I don't want to have to switch to Atlantic time zone just because the form designer couldn't be bothered to include a time zone that actually matched the function of the clocks in my area.

That wasn't my point. If you know you're in GMT-5 and your computer
knows you're in GMT-5, why do you have to peruse a list of 400
choices,
most of which don't match your GMT offset?

>
> Pedantry about the definition of a time zone is not going to win you points with irate users.

Fine. Then make the user scroll through 400 choices. See how many
points that gets you.

>
> Cliff


mensa...@aol.com

unread,
Oct 8, 2007, 9:03:47 PM10/8/07
to
On Oct 8, 3:27 pm, "Chris Mellon" <arka...@gmail.com> wrote:

> On 10/8/07, mensana...@aol.com <mensana...@aol.com> wrote:
>
>
>
>
>
> > On Oct 8, 1:00 pm, "J. Clifford Dyer" <j...@sdf.lonestar.org> wrote:
> > > On Mon, Oct 08, 2007 at 10:41:03AM -0700, mensana...@aol.com wrote regarding Re: pytz has so many timezones!:
>
> > > > On Oct 8, 2:32 am, Sanjay <skpate...@gmail.com> wrote:
> > > > > Hi All,
>
> > > > > I am using pytz.common_timezones to populate the timezone combo box of
> > > > > some user registration form. But as it has so many timezones (around
> > > > > 400),
>
> > > > There are only 25 timezones: -12, -11, ... -1, 0 (GMT), +1, ... +11,
> > > > +12.
>
> > > > A handful of countries set their clocks offset by a half hour,
> > > > but those aren't timezones.
>
> > > I'm sorry. By what even vaguely useful definition of "Timezone" is it not a timezone if it's offset by half an hour?
>
> > The miltary doesn't recognize them as timezones. They'll make
> > a not that the local time observed doesn't match the timezone,
> > but they don't call it a seperate timezone.
>
> What do you mean by "the military" and why do you think they're
> authoritative on the topic of timezones?

Because they publish maps?

> The US timekeeping authority
> is a branch of the US Navy,

Isn't that "the military"?

> but as far as I know they don't define timezones.

Ok, maybe they don't define them. But they get them from somewhere
and the zones are labeled A-Z (don't ask which letter isn't used).
Zone Z is equivalent to GMT and the time is refered to as Zulu time.

That's 25 zones, not 400. Under that system there are no half-hour
offset zones, no zones based on sunset and no lunatic GMT+13 zones.

You'll never learn to run without first learning how to walk.

>
>
>
>
> > > > The 400 you're seeing are duplications based on locality. Of the 86
> > > > shown in Windows, all but 33 are dulplicate references to the same
> > > > timezones.
>
> > > > For example, Windows has seperate listings for
>
> > > > Central America
> > > > Central Time (US & Canada)
> > > > Guadalahara, Mexico City, Monterry - New
> > > > Guadalahara, Mexico City, Monterry - Old
> > > > Saskatchewan
>
> > > > but they are all GMT-6
>
> > > Those are non-duplicate (and perhaps inaccurate, I'm not sure). US time switches from standard to Daylight Savings earlier than Mexico, and switches back later, as of this year.
>
> > Duplicate timezones doesn't mean duplicate time,
> > as you point out. Does the OP want to know the truth
> > or does he want to know something he can understand.
>
> > > Reducing them to a single time zone will result in aberrant functionality in one or more locales.
>
> > I would hardly think that's an issue on the user registration
> > form the OP is trying to create.
>
> It's not clear at all from the OPs post exactly what functionality he
> is trying to derive from the timezone.

Yep, we can't read his mind.

> Since timezones (obviously)
> contain more information than just the GMT offset

Of course. But the GMT offset could be used to filter his list
of 400 choices, couldn't it?

> (otherwise we
> wouldn't even have them), he may very well want to use the timezone
> given by the user to display correct local time to them. In this case,
> the actual, correct, political timezone is important, not just the GMT
> offset.

Agreed. But if someone gave me a list of 400 choices, I would look
for some way to reduce the list to a manageable choice. Isn't that
what the OP wants?

Why not teach him the truth, starting from the top level? Shouldn't
you teach him to fish rather than just give him one?

Nicholas Bastin

unread,
Oct 8, 2007, 9:27:09 PM10/8/07
to mensa...@aol.com, pytho...@python.org
On 10/8/07, mensa...@aol.com <mensa...@aol.com> wrote:
> > What do you mean by "the military" and why do you think they're
> > authoritative on the topic of timezones?
>
> Because they publish maps?

I'm not sure what this has to do with it.

> > but as far as I know they don't define timezones.
>
> Ok, maybe they don't define them. But they get them from somewhere
> and the zones are labeled A-Z (don't ask which letter isn't used).
> Zone Z is equivalent to GMT and the time is refered to as Zulu time.

They get them from NATO. NGO's outside of NATO do not use NATO time
zones for describing time data, mostly because NATO doesn't care about
daylight savings time. Works fine for the military, but not so well
for your civilian users.

> That's 25 zones, not 400. Under that system there are no half-hour
> offset zones, no zones based on sunset and no lunatic GMT+13 zones.

Yes, but lucky for us, we live in the real world, so we have to deal
with 400 time zones. The reality is that people LIVE in those
'lunatic' time zones, and software needs to address that.

If I schedule a meeting with someone in Indiana, and I'm in Ohio,
they're in the same military time zone, but they don't observe
daylight savings time, so in fact our times are different. Users
probably want our applications to handle these problems.

> > Since timezones (obviously)
> > contain more information than just the GMT offset
>
> Of course. But the GMT offset could be used to filter his list
> of 400 choices, couldn't it?

Sortof. First, your user has to understand what GMT is, so that's
already going to cause problems. Secondly, you need to handle time
zones which drift from different GMT offsets depending on the time of
year. At the very least your algorithm needs to be greedy.

> Agreed. But if someone gave me a list of 400 choices, I would look
> for some way to reduce the list to a manageable choice. Isn't that
> what the OP wants?
>
> Why not teach him the truth, starting from the top level? Shouldn't
> you teach him to fish rather than just give him one?

Because the truth is that there are upwards of 400 different time
zones, accounting for local custom and law. The military can
conveniently ignore that, but we as application writers cannot.

There is no central authority which defines global time zones. The
functional definition of a time zone is merely a geographical area of
the earth that has adopted the same local time rules.

--
Nick

mensa...@aol.com

unread,
Oct 9, 2007, 12:55:20 AM10/9/07
to
On Oct 8, 8:27?pm, "Nicholas Bastin" <nick.bas...@gmail.com> wrote:

> On 10/8/07, mensana...@aol.com <mensana...@aol.com> wrote:
>
> > > What do you mean by "the military" and why do you think they're
> > > authoritative on the topic of timezones?
>
> > Because they publish maps?
>
> I'm not sure what this has to do with it.

Maybe you've never had to navigate?

>
> > > but as far as I know they don't define timezones.
>
> > Ok, maybe they don't define them. But they get them from somewhere
> > and the zones are labeled A-Z (don't ask which letter isn't used).
> > Zone Z is equivalent to GMT and the time is refered to as Zulu time.
>
> They get them from NATO. NGO's outside of NATO do not use NATO time
> zones for describing time data, mostly because NATO doesn't care about
> daylight savings time. Works fine for the military, but not so well
> for your civilian users.
>
> > That's 25 zones, not 400. Under that system there are no half-hour
> > offset zones, no zones based on sunset and no lunatic GMT+13 zones.
>
> Yes, but lucky for us, we live in the real world, so we have to deal
> with 400 time zones. The reality is that people LIVE in those
> 'lunatic' time zones, and software needs to address that.

WHY must we accomodate the ignorant? Why not cut them off
from the Internet until they get their act together? Don't
people get mad at Microsoft for breaking standards? People like
you are to blame for accomodating broken standards. "Oh, no,
we can't afford to lose those three potential customers who
live on an island in Kiribati!"

>
> If I schedule a meeting with someone in Indiana, and I'm in Ohio,
> they're in the same military time zone, but they don't observe
> daylight savings time, so in fact our times are different. Users
> probably want our applications to handle these problems.

Isn't that what they call a "locale"?

>
> > > Since timezones (obviously)
> > > contain more information than just the GMT offset
>
> > Of course. But the GMT offset could be used to filter his list
> > of 400 choices, couldn't it?
>
> Sortof. First, your user has to understand what GMT is,

And you start that education by learning the 25 timezones.
Then when you understand that, you can then learn about locales.

> so that's
> already going to cause problems. Secondly, you need to handle time
> zones which drift from different GMT offsets depending on the time of
> year.

It helps to know what you're drifting from.

> At the very least your algorithm needs to be greedy.

How good an algorithm do you think the OP will come up
with if he doesn't understand why his list has 400 items
or has any clue how to reduce it?

>
> > Agreed. But if someone gave me a list of 400 choices, I would look
> > for some way to reduce the list to a manageable choice. Isn't that
> > what the OP wants?
>
> > Why not teach him the truth, starting from the top level? Shouldn't
> > you teach him to fish rather than just give him one?
>
> Because the truth is that there are upwards of 400 different time
> zones,

Locales.

> accounting for local custom and law. The military can
> conveniently ignore that, but we as application writers cannot.

But you can safely ignore the basis of the 400 locales?

>
> There is no central authority which defines global time zones. The
> functional definition of a time zone is merely a geographical area of
> the earth that has adopted the same local time rules.

So, you can live your life with functional definations,
never bothering to learn any theory? Is code monkey all you
aspire to?

>
> --
> Nick


Sanjay

unread,
Oct 9, 2007, 2:05:45 AM10/9/07
to
> It's not clear at all from the OPs post exactly what functionality he
> is trying to derive from the timezone. Since timezones (obviously)
> contain more information than just the GMT offset (otherwise we
> wouldn't even have them), he may very well want to use the timezone
> given by the user to display correct local time to them. In this case,
> the actual, correct, political timezone is important, not just the GMT
> offset.

I am developing a website which would be accessed by members all over
the world. They can exchange data having some time fields, say
'schedule for next meeting'. Whenever somebody feeds some time field,
my application converts it to UTC and stores in the database. Later,
when the data is to be displayed to some member, the application
converts it to his local time, and displays the data.

thanks
Sanjay

Nicholas Bastin

unread,
Oct 9, 2007, 3:03:20 AM10/9/07
to Sanjay, pytho...@python.org

Yeah, you are, unfortunately, probably going to have to deal with the
entirety of this time zone data in this case. You can obviously elide
some information for countries you don't intend to support, but
there's no particular reason to exclude a potential market.

I would say the easiest way to get people to choose their own time
zone is to ask them their country, and then filter their choices by
that. (That would get you down to less than a dozen choices in almost
every country in the world).

--
Nick

Message has been deleted

J. Cliff Dyer

unread,
Oct 9, 2007, 12:55:45 AM10/9/07
to python help
Nicholas Bastin wrote:
>
> There is no central authority which defines global time zones. The
> functional definition of a time zone is merely a geographical area of
> the earth that has adopted the same local time rules.
>

In fact, even the authorities who do define time zones don't always
have the final say. In Xinjiang province in Western China, the
official time zone is the same as Beijing, even though Xinjiang is
about as far west of Beijing as Nevada is from DC, so the sun comes up
around "noon" and sets around "midnight." So many people set their
clocks to unofficial Xinjiang time, three hours offset from Beijing.

In offering a "Xinjiang" timezone set to the unofficial time, you
might win some customers who see you as being on their side. Xinjiang
is a muslim country, so you might also score points with muslims
elsewhere in the world who see their minority Uighur brethren as
oppressed by the authorities of Beijing. On the other hand, you might
annoy the authorities in Beijing. Which is just to say that choice of
time zone is not just a geographic issue. There are political,
diplomatic issues to weigh as well.

Cheers,
Cliff


Nicholas Bastin

unread,
Oct 9, 2007, 2:59:41 AM10/9/07
to mensa...@aol.com, pytho...@python.org
On 10/9/07, mensa...@aol.com <mensa...@aol.com> wrote:
> On Oct 8, 8:27?pm, "Nicholas Bastin" <nick.bas...@gmail.com> wrote:
> > On 10/8/07, mensana...@aol.com <mensana...@aol.com> wrote:
> > > Because they publish maps?
> >
> > I'm not sure what this has to do with it.
>
> Maybe you've never had to navigate?

I don't often find the need to navigate by time zone. Nor do
cartographers consider themselves experts on time, but rather
geography.

> WHY must we accomodate the ignorant? Why not cut them off
> from the Internet until they get their act together? Don't
> people get mad at Microsoft for breaking standards? People like
> you are to blame for accomodating broken standards. "Oh, no,
> we can't afford to lose those three potential customers who
> live on an island in Kiribati!"

There's no broken standard here. I'd advise you to refrain from
painting other people with your own ignorant brush.

> > If I schedule a meeting with someone in Indiana, and I'm in Ohio,
> > they're in the same military time zone, but they don't observe
> > daylight savings time, so in fact our times are different. Users
> > probably want our applications to handle these problems.
>
> Isn't that what they call a "locale"?

No. If we spoke a different language or used a different script,
that'd be a different locale. Of course, we might still be in the
same time zone.

> > > > Since timezones (obviously)
> > > > contain more information than just the GMT offset
> >
> > > Of course. But the GMT offset could be used to filter his list
> > > of 400 choices, couldn't it?
> >
> > Sortof. First, your user has to understand what GMT is,
>
> And you start that education by learning the 25 timezones.
> Then when you understand that, you can then learn about locales.

Just because NATO thinks there's 25 time zones doesn't mean that
they're any more correct than all of the local entities which have
defined their own time zones. And again, your usage of the word
'locale' bears no relationship to the actual definition, in computer
science terms.

> > so that's
> > already going to cause problems. Secondly, you need to handle time
> > zones which drift from different GMT offsets depending on the time of
> > year.
>
> It helps to know what you're drifting from.

You're drifting from UTC. UTC which has no bearing nor controlling
influence on time zone definitions. Just because government entities
reference +/- UTC in time zone definitions does not mean that they're
substantially related.

> > At the very least your algorithm needs to be greedy.
>
> How good an algorithm do you think the OP will come up
> with if he doesn't understand why his list has 400 items
> or has any clue how to reduce it?

I didn't presume the OP was an idiot. I felt that it was much more
reasonable to explain how the 400 differed then to paint for him a
fairy tale of 25 magical time zones, which had no bearing on his
application. There are many ways to filter the 400 based on the needs
of each application, and I leave it as an exercise to the OP to either
deduce the appropriate ones, or ask more questions.

> > > Why not teach him the truth, starting from the top level? Shouldn't
> > > you teach him to fish rather than just give him one?
> >
> > Because the truth is that there are upwards of 400 different time
> > zones,
>
> Locales.

No, locale has already been defined by the computer science community,
and it doesn't involve time zones. There are, realistically, less
than 400 locales. Do not confuse the two. (Locales can be consistent
across many time zones - see en_US for a trivial example). Locales
are coded by language, script, country, and a variant, and do not
contain time zone information.

> > There is no central authority which defines global time zones. The
> > functional definition of a time zone is merely a geographical area of
> > the earth that has adopted the same local time rules.
>
> So, you can live your life with functional definations,
> never bothering to learn any theory? Is code monkey all you
> aspire to?

Well, I certainly don't aspire to be a stuck up ass, which is
apparently what you've been working towards.

There is no magical theory behind time zones. There is no one truth,
and there is no controlling global regulation. Does NATO have a
simple time zone implementation? Absolutely. Is that relevant to
most consumer applications? Absolutely not.

When you write applications for the military, feel free to adhere to
their standards. When you write applications for an international
community, you might want to put the bigotry aside and cater to their
actual needs.

--
Nick

Diez B. Roggisch

unread,
Oct 9, 2007, 9:34:35 AM10/9/07
to
mensa...@aol.com wrote:

That's BS. If I'm supposed to be attending a video-conference that spans a
few continents which is scheduled using a web-app, it's VITAL that I get
the invitation and reminder rendered in MY local timezone, DST included.

And for the matter of

"""
There are only 25 timezones: -12, -11, ... -1, 0 (GMT), +1, ... +11,
+12.
"""

who says that timezones have to be separated by one hour each? Why aren't
they separated by 30minutes, or 20, or 10? Or 2 hours? Or why don't we have
a global time?

Your 25 timezones are an abstraction the same way as are the 400 apparently
in use by people all over the world - and last time I checked, there was no
fundamental law in physics or such that limited the allowed or sensible
number of timezones...

Diez

mensa...@aol.com

unread,
Oct 9, 2007, 1:31:38 PM10/9/07
to
On Oct 9, 2:58 am, Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote:
> On Mon, 08 Oct 2007 10:41:03 -0700, "mensana...@aol.com"
> <mensana...@aol.com> declaimed the following in comp.lang.python:

>
>
>
> > There are only 25 timezones: -12, -11, ... -1, 0 (GMT), +1, ... +11,
> > +12.
>
> Uhm... -12 and +12 would be the same, wouldn't they?

No, they are seperated by the International Date Line,
so although zones -12 & +12 have the same clock time, they
are different dates.

>
> There are only 24 divisions 15deg wide in longitude, 7.5deg to each
> size of zone center, and Greenwich is center of 0...

And zones -12 & +12 are each nominally 7.5deg wide,
so 23*15 + 2*7.5 gives you 25 zones spanning 360deg.

>
> However, consider that the former Soviet Union is reputed to have
> used only ONE timezone for the entire width of the country (sunrise at
> 6AM say in Moscow would be near sunset on the east coast)

When was this, in the days before air travel when it took
3 weeks to cross Siberia by train?

>
> So while there are only 24 hourly offsets, there can be many "zones"
> to reflect variations in daylight time changes or non-standard
> offsets...

The point I was trying to make is that although there may
be 400 zones, there aren't 400 offsets. And aren't these
offsets part of the timezone record?

> --
> Wulfraed Dennis Lee Bieber KD6MOG
> wlfr...@ix.netcom.com wulfr...@bestiaria.com
> HTTP://wlfraed.home.netcom.com/
> (Bestiaria Support Staff: web-a...@bestiaria.com)
> HTTP://www.bestiaria.com/


mensa...@aol.com

unread,
Oct 9, 2007, 2:21:41 PM10/9/07
to
On Oct 9, 8:34 am, "Diez B. Roggisch" <de...@nospam.web.de> wrote:

> mensana...@aol.com wrote:
> > On Oct 8, 1:03 pm, Carsten Haese <cars...@uniqsys.com> wrote:
> >> On Mon, 2007-10-08 at 10:41 -0700, mensana...@aol.com wrote:
> >> > For example, Windows has seperate listings for
>
> >> > Central America
> >> > Central Time (US & Canada)
> >> > Guadalahara, Mexico City, Monterry - New
> >> > Guadalahara, Mexico City, Monterry - Old
> >> > Saskatchewan
>
> >> > but they are all GMT-6
>
> >> But they could have different rules for Daylight Saving Time.
>
> > Which only matters if you're setting your clock.
>
> That's BS. If I'm supposed to be attending a video-conference that spans a
> few continents which is scheduled using a web-app, it's VITAL that I get
> the invitation and reminder rendered in MY local timezone, DST included.
>
> And for the matter of
>
> """
> There are only 25 timezones: -12, -11, ... -1, 0 (GMT), +1, ... +11,
> +12.
> """
>
> who says that timezones have to be separated by one hour each?

The Earth says. It takes 24 hours to revolve.

> Why aren't they separated by 30minutes, or 20, or 10? Or 2 hours?

Why isn't an hour defined to be 30 minutes?

> Or why don't we have a global time?

Like UTC?

>
> Your 25 timezones are an abstraction the same way

Not the same way at all. The 25 timezones I speak of are
not merely an abstraction, but related to longitude.

> as are the 400 apparently in use by people all over the world

Where the correlation to longitude is much looser.
Granted, it doesn't need to be for non-navigational
purposes. And although governments can legislate things
like DST, they can't legislate longitude.

> - and last time I checked, there was no
> fundamental law in physics or such that limited the allowed or sensible
> number of timezones...

Isn't there some law somewhere that says the circumference
of a sphere is 360deg? Doesn't that same law mean that no two
points on a sphere can be seperated by more than 180deg
longitude? Doesn't that make GMT+13 non-sensible?

>
> Diez

J. Clifford Dyer

unread,
Oct 9, 2007, 2:39:09 PM10/9/07
to mensa...@aol.com, pytho...@python.org
On Tue, Oct 09, 2007 at 11:21:41AM -0700, mensa...@aol.com wrote regarding Re: pytz has so many timezones!:
>
> The Earth says. It takes 24 hours to revolve.
>
> > Why aren't they separated by 30minutes, or 20, or 10? Or 2 hours?
>
> Why isn't an hour defined to be 30 minutes?
>
> > Or why don't we have a global time?
>
> Like UTC?
>
> >
> > Your 25 timezones are an abstraction the same way
>
> Not the same way at all. The 25 timezones I speak of are
> not merely an abstraction, but related to longitude.
>
> > as are the 400 apparently in use by people all over the world
>
> Where the correlation to longitude is much looser.
> Granted, it doesn't need to be for non-navigational
> purposes. And although governments can legislate things
> like DST, they can't legislate longitude.
>
> > - and last time I checked, there was no
> > fundamental law in physics or such that limited the allowed or sensible
> > number of timezones...
>
> Isn't there some law somewhere that says the circumference
> of a sphere is 360deg? Doesn't that same law mean that no two
> points on a sphere can be seperated by more than 180deg
> longitude? Doesn't that make GMT+13 non-sensible?
>

You seem to be talking about time zones as if they are a scientific abstraction based on the physical layout of the earth. They are not. They are an abstraction away from true scientific (solar) time to give us regular 24 hour days, and to simplify calculation to make sure that trains don't run into one another for having left their respective stations at times based on locally defined solar noon. Solar time is the only kind of time that doesn't have to take political considerations into account.

GMT+13 is not non-sensible at all, if the major trade partners of the island in question are at GMT+12. Imagine the confusion not being able to schedule meetings on monday or friday because your next door neighbor, one time zone away, is actually off-calendar from you by one day. The IDL was arbitrarily placed in the middle of the pacific to limit this problem to as few people as possible, but the people of Kiribati have no reason to accept the disadvantage under which this (European) abstraction places them. What would be non-sensible is for them to live 23 hours offset from their closest neighbors and family, while living a mere three hours offset from people that they have minimal contact with.

Cheers,
Cliff

Chris Mellon

unread,
Oct 9, 2007, 2:57:59 PM10/9/07
to pytho...@python.org
On 10/9/07, mensa...@aol.com <mensa...@aol.com> wrote:
> > Why aren't they separated by 30minutes, or 20, or 10? Or 2 hours?
>
> Why isn't an hour defined to be 30 minutes?
>
> > Or why don't we have a global time?
>
> Like UTC?
>
> >
> > Your 25 timezones are an abstraction the same way
>
> Not the same way at all. The 25 timezones I speak of are
> not merely an abstraction, but related to longitude.
>

See, here's what the problem is. You've invented your own definition
of "timezone", which has no relation to how anyone else uses the word,
and are now arguing loudly and rudely about how your pet definition is
right, and everyone else is wrong.

You should have just said at the beginning that you were just
redefining all the terms to match your preference, so I could have
killfilled you then instead of reading all your posts in hope that you
actually had something important and useful to say.

Bill Hamilton

unread,
Oct 9, 2007, 3:09:39 PM10/9/07
to pytho...@python.org
On 10/9/07, mensa...@aol.com <mensa...@aol.com> wrote:
> On Oct 9, 8:34 am, "Diez B. Roggisch" <de...@nospam.web.de> wrote:
> > mensana...@aol.com wrote:
> > > On Oct 8, 1:03 pm, Carsten Haese <cars...@uniqsys.com> wrote:
> > >> On Mon, 2007-10-08 at 10:41 -0700, mensana...@aol.com wrote:
> > >> > For example, Windows has seperate listings for
> >
> > >> > Central America
> > >> > Central Time (US & Canada)
> > >> > Guadalahara, Mexico City, Monterry - New
> > >> > Guadalahara, Mexico City, Monterry - Old
> > >> > Saskatchewan
> >
> > >> > but they are all GMT-6
> >
> > >> But they could have different rules for Daylight Saving Time.
> >
> > > Which only matters if you're setting your clock.
> >
> > That's BS. If I'm supposed to be attending a video-conference that spans a
> > few continents which is scheduled using a web-app, it's VITAL that I get
> > the invitation and reminder rendered in MY local timezone, DST included.
> >
> > And for the matter of
> >
> > """
> > There are only 25 timezones: -12, -11, ... -1, 0 (GMT), +1, ... +11,
> > +12.
> > """
> >
> > who says that timezones have to be separated by one hour each?
>
> The Earth says. It takes 24 hours to revolve.
It only takes 24 hours for the Earth to revolve once because we
defined an hour as 1/24 of the time it takes for the Earth to revolve
once. We could have said an hour was 1/10 that time, or 1/2, or
1/27.284.

>
> > Or why don't we have a global time?
>
> Like UTC?

What about GMT? I hear that much more than UTC.

>
> >
> > Your 25 timezones are an abstraction the same way
>
> Not the same way at all. The 25 timezones I speak of are
> not merely an abstraction, but related to longitude.
>
> > as are the 400 apparently in use by people all over the world
>
> Where the correlation to longitude is much looser.
> Granted, it doesn't need to be for non-navigational
> purposes. And although governments can legislate things
> like DST, they can't legislate longitude.
>

But your 25 timezones are only useful to the people that use those 25
timezones. And the time zone I use is not one of those 25 timezones.

> > - and last time I checked, there was no
> > fundamental law in physics or such that limited the allowed or sensible
> > number of timezones...
>
> Isn't there some law somewhere that says the circumference
> of a sphere is 360deg? Doesn't that same law mean that no two
> points on a sphere can be seperated by more than 180deg
> longitude? Doesn't that make GMT+13 non-sensible?

A timezone is an arbitrary geographical designation. It has nothing
to do with latitude or longitude. While some time zones may be
defined as a geographical region between two longitudes, others may be
defined by geographical borders or convienent terrain features. Take
a look at the international date line. It doesn't follow a
longitudinal line, but instead jogs east around Asia and then west
around the Aleutian Islands.


--
-Bill Hamilton

Diez B. Roggisch

unread,
Oct 9, 2007, 5:24:52 PM10/9/07
to
>> who says that timezones have to be separated by one hour each?
>
> The Earth says. It takes 24 hours to revolve.
Wrong

Diez B. Roggisch

unread,
Oct 9, 2007, 5:32:27 PM10/9/07
to
>> who says that timezones have to be separated by one hour each?
>
> The Earth says. It takes 24 hours to revolve.

Your kidding me, aren't you? Beside the fact that the earth does not
revolve in 24h (leap seconds, if you like to google), even the 24 hours
of a day are as arbitrary as you prefer. I'm writing this at 23:26, but
I bet quite a few people call that 11:26PM. So - who's right?


>> Why aren't they separated by 30minutes, or 20, or 10? Or 2 hours?
>
> Why isn't an hour defined to be 30 minutes?
>
>> Or why don't we have a global time?
>
> Like UTC?

Which I'm sure is the time you have on your wristwatch?


> Not the same way at all. The 25 timezones I speak of are
> not merely an abstraction, but related to longitude.

Again: BS. Deciding that the the actual noon (the time the sun is at
it's highest point) is the 12:00 on my clock was defined by someone.
It's sensible, but arbitrary. As is the decision about the width of such
a timezone.

>> as are the 400 apparently in use by people all over the world
>
> Where the correlation to longitude is much looser.
> Granted, it doesn't need to be for non-navigational
> purposes. And although governments can legislate things
> like DST, they can't legislate longitude.

They can. The greniwch meridian is nothing but a convention.


>> - and last time I checked, there was no
>> fundamental law in physics or such that limited the allowed or sensible
>> number of timezones...
>
> Isn't there some law somewhere that says the circumference
> of a sphere is 360deg? Doesn't that same law mean that no two
> points on a sphere can be seperated by more than 180deg
> longitude? Doesn't that make GMT+13 non-sensible?


Others have given you reasons why it _is_ sensible to have GMT+13.

Diez

mensa...@aol.com

unread,
Oct 10, 2007, 2:18:16 AM10/10/07
to
I apologize for being a dick. It won't happen again.

I was actually thinking that the 25 standard
timezones (which make a reasonable list or
can be easily generated by clicking a map)
could serve as a filter to make the detail
list reasonably sized.

Something like this:

import pytz
import datetime
import sqlite3
import random

utc = pytz.timezone('UTC')
utc_dt = datetime.datetime(2007,1,1,0,0,0,tzinfo=utc)
offset_zone = []

for i in pytz.all_timezones:
the_zone = pytz.timezone(i)
loc_dt = utc_dt.astimezone(the_zone)
loc_offset = loc_dt.strftime('%z')
offset_zone.append((loc_offset,the_zone.zone))

con = sqlite3.connect(":memory:")
cur = con.cursor()
cur.executescript("""
create table tz(
offset,
zone
);
""")

cur.executemany("""
INSERT INTO tz(offset,
zone)
VALUES (?,?)"""
, offset_zone)

cur.execute("""
SELECT DISTINCT offset
FROM tz
WHERE offset LIKE '+%'
ORDER BY offset;
""")

east = cur.fetchall()

cur.execute("""
SELECT DISTINCT offset
FROM tz
WHERE offset LIKE '-%'
ORDER BY offset DESC;
""")

west = cur.fetchall()

distinct_offsets = east + west

print
print 'Choose your GMT offset:'
for i in distinct_offsets:
if i[0]=='+0000' or i[0]=='+0600' or i[0]=='+1200' or i[0]=='-1200'
or i[0]=='-0600':
print
print i[0],

print
print

the_choice = random.choice(distinct_offsets)

print 'Offset',the_choice[0],'chosen.'
print

cur.execute("""
SELECT offset,
zone
FROM tz
WHERE offset=?
ORDER BY offset;
""",the_choice)

list_o_zones = cur.fetchall()

print 'Which timezone?'
print

for i in list_o_zones: print i[0],i[1]


## Choose your GMT offset:
##
## +0000 +0100 +0200 +0300 +0330 +0400 +0430 +0500 +0530 +0545
## +0600 +0630 +0700 +0800 +0900 +0930 +0945 +1000 +1030 +1100 +1130
## +1200 +1300 +1345 +1400
## -1200 -1100 -1000 -0930 -0900 -0800 -0700
## -0600 -0500 -0400 -0330 -0300 -0200 -0100
##
## Offset -0930 chosen.
##
## Which timezone?
##
## -0930 Pacific/Marquesas
##
##
##
## Choose your GMT offset:
##
## +0000 +0100 +0200 +0300 +0330 +0400 +0430 +0500 +0530 +0545
## +0600 +0630 +0700 +0800 +0900 +0930 +0945 +1000 +1030 +1100 +1130
## +1200 +1300 +1345 +1400
## -1200 -1100 -1000 -0930 -0900 -0800 -0700
## -0600 -0500 -0400 -0330 -0300 -0200 -0100
##
## Offset +0945 chosen.
##
## Which timezone?
##
## +0945 Australia/Eucla
##
##
##
## Choose your GMT offset:
##
## +0000 +0100 +0200 +0300 +0330 +0400 +0430 +0500 +0530 +0545
## +0600 +0630 +0700 +0800 +0900 +0930 +0945 +1000 +1030 +1100 +1130
## +1200 +1300 +1345 +1400
## -1200 -1100 -1000 -0930 -0900 -0800 -0700
## -0600 -0500 -0400 -0330 -0300 -0200 -0100
##
## Offset -0100 chosen.
##
## Which timezone?
##
## -0100 America/Scoresbysund
## -0100 Atlantic/Azores
## -0100 Atlantic/Cape_Verde
## -0100 Etc/GMT+1
##
##
##
## Choose your GMT offset:
##
## +0000 +0100 +0200 +0300 +0330 +0400 +0430 +0500 +0530 +0545
## +0600 +0630 +0700 +0800 +0900 +0930 +0945 +1000 +1030 +1100 +1130
## +1200 +1300 +1345 +1400
## -1200 -1100 -1000 -0930 -0900 -0800 -0700
## -0600 -0500 -0400 -0330 -0300 -0200 -0100
##
## Offset +1000 chosen.
##
## Which timezone?
##
## +1000 Antarctica/DumontDUrville
## +1000 Asia/Sakhalin
## +1000 Asia/Vladivostok
## +1000 Australia/Brisbane
## +1000 Australia/Lindeman
## +1000 Australia/Queensland
## +1000 Etc/GMT-10
## +1000 Pacific/Guam
## +1000 Pacific/Port_Moresby
## +1000 Pacific/Saipan
## +1000 Pacific/Truk
## +1000 Pacific/Yap
##
##
##
## Choose your GMT offset:
##
## +0000 +0100 +0200 +0300 +0330 +0400 +0430 +0500 +0530 +0545
## +0600 +0630 +0700 +0800 +0900 +0930 +0945 +1000 +1030 +1100 +1130
## +1200 +1300 +1345 +1400
## -1200 -1100 -1000 -0930 -0900 -0800 -0700
## -0600 -0500 -0400 -0330 -0300 -0200 -0100
##
## Offset +0300 chosen.
##
## Which timezone?
##
## +0300 Africa/Addis_Ababa
## +0300 Africa/Asmara
## +0300 Africa/Asmera
## +0300 Africa/Dar_es_Salaam
## +0300 Africa/Djibouti
## +0300 Africa/Kampala
## +0300 Africa/Khartoum
## +0300 Africa/Mogadishu
## +0300 Africa/Nairobi
## +0300 Antarctica/Syowa
## +0300 Asia/Aden
## +0300 Asia/Baghdad
## +0300 Asia/Bahrain
## +0300 Asia/Kuwait
## +0300 Asia/Qatar
## +0300 Asia/Riyadh
## +0300 Etc/GMT-3
## +0300 Europe/Moscow
## +0300 Europe/Volgograd
## +0300 Indian/Antananarivo
## +0300 Indian/Comoro
## +0300 Indian/Mayotte
## +0300 W-SU

## Choose your GMT offset:
##
## +0000 +0100 +0200 +0300 +0330 +0400 +0430 +0500 +0530 +0545
## +0600 +0630 +0700 +0800 +0900 +0930 +0945 +1000 +1030 +1100 +1130
## +1200 +1300 +1345 +1400
## -1200 -1100 -1000 -0930 -0900 -0800 -0700
## -0600 -0500 -0400 -0330 -0300 -0200 -0100
##
## Offset -0600 chosen.
##
## Which timezone?
##
## -0600 America/Belize
## -0600 America/Cancun
## -0600 America/Chicago
## -0600 America/Costa_Rica
## -0600 America/El_Salvador
## -0600 America/Guatemala
## -0600 America/Indiana/Knox
## -0600 America/Indiana/Petersburg
## -0600 America/Indiana/Tell_City
## -0600 America/Indiana/Vincennes
## -0600 America/Indiana/Winamac
## -0600 America/Knox_IN
## -0600 America/Managua
## -0600 America/Menominee
## -0600 America/Merida
## -0600 America/Mexico_City
## -0600 America/Monterrey
## -0600 America/North_Dakota/Center
## -0600 America/North_Dakota/New_Salem
## -0600 America/Rainy_River
## -0600 America/Rankin_Inlet
## -0600 America/Regina
## -0600 America/Swift_Current
## -0600 America/Tegucigalpa
## -0600 America/Winnipeg
## -0600 CST6CDT
## -0600 Canada/Central
## -0600 Canada/East-Saskatchewan
## -0600 Canada/Saskatchewan
## -0600 Etc/GMT+6
## -0600 Mexico/General
## -0600 Pacific/Galapagos
## -0600 US/Central
## -0600 US/Indiana-Starke

Why do all the Etc/GMTxxx zones appear to have
the sign of their offset reversed? Such as
-0600 for Etc/GMT+6?

Sanjay

unread,
Oct 10, 2007, 4:11:26 AM10/10/07
to
Thanks a lot, Guys. The immediate step I think to take is having two
combo boxes (dividing the data by '/'). Thanks for enormous response
and the valuable suggestions!

Sanjay

Message has been deleted

Jerry Hill

unread,
Oct 10, 2007, 8:56:12 AM10/10/07
to pytho...@python.org

The most elegant way I've seen to handle this in a graphical interface
(either a web app, or a full GUI), is to present the user with some
sort of map where they can click on their approximate location, and
then select the appropriate timezone from there. I don't think that
the pytz module is set up to support that interface very well though.

--
Jerry

0 new messages