[Tutor] Date comparison across time zones

Mark Tolonen metolone+gmane at gmail.com
Wed Jan 14 03:48:39 CET 2009


"frenc1z 1z" <frenc1z at gmail.com> wrote in message 
news:7b60d8a80901130845s30842deeuba55afec99285a5c at mail.gmail.com...
> Hello,
>
> I'm a novice python (python 2.6.1) user with the following problem.
>
> Never though this was going to be so difficult :-).
>
> 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"

Check out the email.utils module, specifically the parsedate_tz and 
mktime_tz functions.

-Mark




More information about the Tutor mailing list