datetime and timezone conversion with pytz - mind blowing behaviour datetime and timezone conversion with pytz - mind blowing behaviour django django

datetime and timezone conversion with pytz - mind blowing behaviour


The documentation http://pytz.sourceforge.net/ states "Unfortunately using the tzinfo argument of the standard datetime constructors 'does not work' with pytz for many timezones." The code:

t = datetime(    2013, 5, 11, hour=11, minute=0,    tzinfo=pytz.timezone('Europe/Warsaw'))

doesn't work according to this, instead you should use the localize method:

t = pytz.timezone('Europe/Warsaw').localize(        datetime(2013, 5, 11, hour=11, minute=0))