Skip to content

Instantly share code, notes, and snippets.

@ezk84
Created November 12, 2013 01:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ezk84/7424101 to your computer and use it in GitHub Desktop.
Save ezk84/7424101 to your computer and use it in GitHub Desktop.
Changing timezones in python
import dateutil.parser
import pytz
input = '2013-10-13T00:59:45Z' # Zulu time = UTC
tz_syd = pytz.timezone('Australia/Sydney')
dt_utc = dateutil.parser.parse(intput)
dt_syd = dt_utc.astimezone(tz_syd)
print dt_syd.isoformat() # prints 2013-10-13T11:59:45+11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment