How to parse Chrome bookmarks "date_added" value to a Date

I like to prototype these things in a spreadsheet and then it should be trivial to code the coded formula in whichever language you happen to be working with.

Formula = "2001-1-1" + A2/24/60/60/1000000 - 400*365.25+3+7/24

Explanation:

  • Starting with an arbitrary date that Excel (what I'm using as a spreadsheet) can handle... Jan1, 2001
  • Add the bookmark's data value [date_added] or [last_visited_desktop] or [date_modified] (in cell A2 in my formula above) in terms of days (24 hours by 60 minutes by 60 seconds by a millionth of a second
  • subtract 400 years in terms of days (that's 400 years including leap year days and 7 hours worth of clock adjustments since by 2001 date above, because somehow COBOL developers got stuck on year 1601, which became year 1 for them, so they made that their 'epoch'. Funny how things get started, eh?)

For example, Chrome's Bookmark [date_added] value is "13190650905699900", so: "2001-1-1"+ 13190650905699900/24/60/60/1000000 - 400*365.25+3+7/24 yields 12/30/2018 8:41:46pm

You can find the Bookmarks file here:

%LOCALAPPDATA%\Google\Chrome\User Data\Default\Bookmarks

as of current version of Chrome (v71)

PS - Window Time utility can do it for you too if all you want is a quick one-time conversion: type

w32tm.exe /ntte 131906509056999000

at a command prompt - notice I had to add a '0' (or multiply by 10).


It's WebKit/Chrome Timestamp, representing microseconds since 1601/1/1 UTC.

It comes from Windows NT Timestamp (as 100-nanoseconds since 1601/1/1 UTC), available as FileTime structure.

There is an online WebKit/Chrome Timestamp Converter in https://www.epochconverter.com/webkit

which provides its code there as well.

However the code is in Python2, so I transcribe it to Python3 as below:

import datetime
def date_from_webkit(webkit_timestamp):
    epoch_start = datetime.datetime(1601,1,1)
    delta = datetime.timedelta(microseconds=int(webkit_timestamp))
    print(epoch_start + delta) # py3 requires () for print

date_from_webkit(int(input('Enter a Webkit timestamp to convert: '))) # py3 integrates raw_input() and input() into input()

The Chrome bookmarks time value is microseconds from an epoch of 1601-01-01T00:00:00Z. To convert to a Date:

  1. Divide by 1,000 to get milliseconds
  2. Adjust to an epoch of 1970-01-01T00:00:00Z
  3. Pass the resulting value to the Date constructor

E.g.

var timeValue = '13170147422089597';
new Date(Date.UTC(1601,0,1) + timeValue / 1000); // 2018-05-07T06:17:02.089Z

Storing the value Date.UTC(1601,0,1) as a constant (-11644473600000) and converting to a function gives:

function chromeTimeValueToDate(tv) {
  var epoch = -11644473600000;
  return new Date(epoch + tv / 1000);
}

// Example
['13170147422089597',
 '13150297844686316',
 '13115171381595644'].forEach( tv => {
   console.log(chromeTimeValueToDate(tv))
});