Created
November 14, 2017 18:08
-
-
Save harrtho/313363e1eb2faecf858f384665657c62 to your computer and use it in GitHub Desktop.
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
# Python 2 | |
import datetime | |
def getFiletime(dt): | |
microseconds = int(dt, 16) / 10 | |
seconds, microseconds = divmod(microseconds, 1000000) | |
days, seconds = divmod(seconds, 86400) | |
return datetime.datetime(1601, 1, 1) + datetime.timedelta(days, seconds, microseconds) | |
print format(getFiletime(hex(13024882639633631*10)[2:17]), '%a, %d %B %Y %H:%M:%S %Z') | |
# Python 3 | |
import datetime | |
def getFiletime(dtms): | |
seconds, micros = divmod(dtms, 1000000) | |
days, seconds = divmod(seconds, 86400) | |
return datetime.datetime(1601, 1, 1) + datetime.timedelta(days, seconds, micros) | |
print( getFiletime(13024882639633631).strftime( '%a, %d %B %Y %H:%M:%S %Z' ) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment