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,
tzinfo=tz).utcoffset()
0:09:00
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))
2:00:00
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
--
Florent Guillaume, Nuxeo (Paris, France) Director of R&D
+33 1 40 33 71 59 http://nuxeo.com [EMAIL PROTECTED]
_______________________________________________
Zope3-dev mailing list
[email protected]
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com