Marius Gedminas wrote:
On Mon, Jul 24, 2006 at 01:08:39AM +0200, Florent Guillaume wrote:
Sorry about the offtopic, but can anyone shed some light on this:

import pytz
from datetime import datetime
tz = pytz.timezone('Europe/Paris'); print datetime(2006, 7, 1,
I expected 1 hour, not 9 minutes???

Read pytz/README.txt.  You're not supposed to pass tzinfo to datetime.
You're supposed to write

  >>> tz = pytz.timezone('Europe/Paris')
  >>> print tz.localize(datetime(2006, 7, 1))

As you can see, in summer the offset is 2 hours due to daylight savings.

Thanks. I'd seen localize() in the README but all the examples have an explicit is_dst passed which I didn't want. I didn't realize that without it it would guess the right one (except during the 1h ambiguous period).


Florent Guillaume, Nuxeo (Paris, France)   Director of R&D
+33 1 40 33 71 59   [EMAIL PROTECTED]
Zope3-dev mailing list

Reply via email to