Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pytz, dateutil.parser
- # Z is for timezone
- gmtTime = dateutil.parser.parse("2011-07-14T6:00:00.000Z")
- # To convert naive time to tz-aware time
- now-aware = pytz.UTC.localize(naive-time)
- # To convert UTC time to localtime
- # weird huh? shouldnt it be Asia/Hanoi
- localtime = utcTime.astimezone(pytz.timezone("Asia/Ho_Chi_Minh"))
- # Create a datetime variable with timezone
- start = datetime(1970, 1, 1, tzinfo=pytz.UTC)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement