"frenc1z 1z" <fren...@gmail.com> wrote

I'm a novice python (python 2.6.1) user with the following problem.

Never though this was going to be so difficult :-).

Timezones are devilishly difficult to do if you need to be complete.
If you are only dealing with the Western world then its not so bad
and most libraries will work.

I would like to compare some dates (date+time really). The dates all have
the following RFC2822 format:

Eg. is d1 < d2?
d1 = "Tue, 13 Jan 2009 03:27:29 -0800"
d2 = "Tue, 13 Jan 2009 02:40:00 -0600"

My thinking is that I first need to make these two dates comparable, and eliminate the impact of time zone and dst. Understand that I can acheive
this using strptime.

You can convert to UTC time and compare that way. That avoids issues
of having two different timezones in the conversion functions and conflicts
within  the TZ. environment variables. tzset() should work.

Be sure to turn the timezone back to wjatever it was before (store tzname)
when you are done.

HTH,

Alan G.

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to