Last active
June 26, 2017 23:53
-
-
Save JulianNorton/0fdfb8436a9ef94f185e19304d396fd1 to your computer and use it in GitHub Desktop.
Convert UNIX timestamp to human readable date
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
from datetime import datetime as dt | |
# timestamp microseconds | |
timestamp = '1490871689000' | |
# String to remove miliseconds or it'll break | |
converted_timestamp = int(timestamp[:-3]) | |
# I want a timestamp that's human readable! | |
converted_timestamp = dt.fromtimestamp(converted_timestamp) | |
# 2017-03-30 07:01:29 | |
# THIS CHANGES DEPENDING ON YOUR TIME ZONE! | |
print(converted_timestamp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment