In article 
<[EMAIL PROTECTED]>,
 manatlan <[EMAIL PROTECTED]> wrote:
> Here is a really simple code :
> -------------------------------------------------------
> from datetime import datetime
> from pytz import timezone
> 
> tz=timezone("Europe/Paris")
> 
> d=datetime(2008,12,12,19,00,00,tzinfo=tz)
> print d.isoformat()
> 
> d=datetime.now(tz)
> print d.isoformat()
> -------------------------------------------------------
> when I run it, it displays (according current time ;-):
> 
> 2008-12-12T19:00:00+00:09
> 2008-12-05T19:15:38.135467+01:00
> 
> The Europe/Paris timezone is GMT+1 ... the second date seems to be
> right (+01:00 at the end)
> 
> But why the first date ends with "+00:09" ?!? it should be +01:00 ...
> no ?!
> Where's the bug ?!? (sure : it's me ;-) ... but i don't understand
> this simple thing)

>>> tz = timezone("Europe/Paris")
>>> d = tz.localize(datetime(2008,12,12,19,00,00))
>>> print d.isoformat()
2008-12-12T19:00:00+01:00

<http://pytz.sourceforge.net/>

"This library only supports two ways of building a localized time. The 
first is to use the .localize() method provided by the pytz library. 
This is used to localize a naive datetime (datetime with no timezone 
information).  ... Unfortunately using the tzinfo argument of the 
standard datetime constructors ''does not work'' with pytz for many 
timezones."

-- 
 Ned Deily,
 [EMAIL PROTECTED]

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

Reply via email to