Created
September 10, 2013 22:15
-
-
Save jharmn/6516536 to your computer and use it in GitHub Desktop.
A python-based example of timezone resolution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import datetime | |
| from pytz import timezone | |
| from dateutil.parser import parse | |
| appt = parse("2013-08-16T15:30:15Z") #From UTC/Zulu time | |
| tzinfo = timezone("America/Chicago") #Retrieve timezone info for US Central | |
| apptLocal = appt.astimezone(tzinfo) # Date is modulated as 2013-08-16 10:30:15-05:00 | |
| print apptLocal | |
| # Produces 2013-08-16 10:30:15-05:00 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment