Last active
March 27, 2020 22:42
-
-
Save joonro/5f079e2571f4ca199dd429b070ee5644 to your computer and use it in GitHub Desktop.
[Python dealing with UTC timestamps] 2020-03-27 It seems this method is accurate because it explicitly specifies UTC time. #pyhton #time
This file contains 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 | |
# get UTC timestamp in seconds | |
datetime_utc_origin = datetime.datetime(1970, 1, 1) | |
# now | |
utc_timestamp_now = (datetime.datetime.utcnow() - datetime_utc_origin).total_seconds() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment