>>> from datetime import datetime
>>> import pytz
>>> from pytz import timezone
>>> utc = pytz.utc
>>> paris = timezone('Europe/Paris')
>>> now = datetime.utcnow()
>>> utc_now = now.replace(tzinfo=utc)
>>> utc_now
datetime.datetime(2011, 4, 1, 15, 30, 39, 337114, tzinfo=)
>>> utc_now.astimezone(paris)
datetime.datetime(2011, 4, 1, 17, 30, 39, 337114, tzinfo=)
here I will gather some notes on my python use. I will give my impressions on different libs when I can give them a try to solve the problem at hand. Also I will announce some releases when I think some of my packages might be useful to others.
Search This Blog
01 April 2011
Playing with time zones
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment