How can I convert UTC to Pacific time zone in Python?
I tried this but it is not working
from datetime import datetime
from pytz import timezone
fmt = "%Y-%m-%d %H:%M:%S %Z%z"
# Current time in UTC
now_utc = 1348283733848
# Convert to US/Pacific time zone
now_pacific = now_utc.astimezone(timezone('US/Pacific'))
print now_pacific.strftime(fmt)
Error:
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
AttributeError: 'long' object has no attribute 'astimezone
I want to convert this UTC 1348283733848 to pacific time zone in human readble format