-
-
Save seanbehan/dd9d4ebd56ce8266f9d6 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
utc_to_local.py | |
Example of converting UTC to local time using python-dateutil. | |
https://pypi.python.org/pypi/python-dateutil | |
""" | |
from datetime import datetime | |
from dateutil.tz import tzutc, tzlocal | |
utc = datetime.now(tzutc()) | |
print('UTC: ' + str(utc)) | |
local = utc.astimezone(tzlocal()) | |
print('Local: ' + str(local)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment