Created
February 13, 2017 17:32
-
-
Save jbfuzier/7ee6ecdb716f8bb69c8555b437abef08 to your computer and use it in GitHub Desktop.
Revisions
-
jbfuzier created this gist
Feb 13, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ from dateutil import tz tzone = tz.gettz('Europe/Paris') utc = tz.gettz('UTC') # Make datetime object timezone aware datetime_local = datetime_local.replace(tzinfo=tzone) # Do the timezone change date_utc = datetime_local.astimezone(utc) # Epoch timestamp to timezone aware datetime datetime.datetime.utcfromtimestamp(time).replace(tzinfo=utc)