Skip to content

Instantly share code, notes, and snippets.

@keithxm23
Created January 13, 2016 16:11
Show Gist options
  • Save keithxm23/d34d9aaa1a4b855ddbc0 to your computer and use it in GitHub Desktop.
Save keithxm23/d34d9aaa1a4b855ddbc0 to your computer and use it in GitHub Desktop.
Tiny Python script to convert the 'date_added' field in the Chrome Bookmarks file to a readable format. Usage: python chrome_to_time.py 13024882639633631 Credits to Zaw Lin http://stackoverflow.com/a/19076132/1415352 for this!
import datetime
import sys
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)
#http://stackoverflow.com/a/19076132/1415352
if __name__ == "__main__":
print format(getFiletime(hex(int(sys.argv[1])*10)[2:17]), '%a, %d %B %Y %H:%M:%S %Z')
# E.g. 13024882639633631 = Sat, 28 September 2013 22:57:19
#usage: python chrome_to_time.py 13024882639633631
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment