pytz working for Singapore
>>> import pytz | |
>>> from datetime import datetime | |
>>> time_zone = pytz.timezone('Asia/Singapore') | |
>>> my_time = datetime.utcnow() | |
>>> my_time | |
datetime.datetime(2012, 9, 7, 12, 6, 15, 56631) | |
>>> my_time.replace(tzinfo=pytz.utc) | |
datetime.datetime(2012, 9, 7, 12, 6, 15, 56631, tzinfo=<UTC>) | |
>>> my_time = my_time.replace(tzinfo=pytz.utc) | |
>>> my_time.astimezone(time_zone) | |
datetime.datetime(2012, 9, 7, 20, 6, 15, 56631, tzinfo=<DstTzInfo 'Asia/Singapore' SGT+8:00:00 STD>) | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment