On 5 déc, 20:46, Ned Deily <[EMAIL PROTECTED]> wrote: > In article > <[EMAIL PROTECTED]>, > > > > manatlan <[EMAIL PROTECTED]> wrote: > > Here is a really simple code : > > ------------------------------------------------------- > > from datetime import datetime > > frompytzimport 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 thepytzlibrary. > 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'' withpytzfor many > timezones." > > -- > Ned Deily, > [EMAIL PROTECTED]
now, I use : d=datetime.now(tz).replace(2008,12,12,19,00,00) and it works like expected ... btw, thanks for your answer -- http://mail.python.org/mailman/listinfo/python-list