Skip to content

Instantly share code, notes, and snippets.

@lindekaer
Last active September 12, 2020 03:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lindekaer/cbc0eafaedb064e1828b059b7af4ce11 to your computer and use it in GitHub Desktop.
Save lindekaer/cbc0eafaedb064e1828b059b7af4ce11 to your computer and use it in GitHub Desktop.
Convert Google Chrome bookmark timestamp to JS date
// A Webkit timestamp is the number of microseconds from "1st of Jan 1601"
// The magic number 11644473600 is the number of seconds between
// "1st of Jan 1601" and "1st of Jan 1970"
export const converWebkitTimestamp = (webkitTimestamp: number): Date => {
const dateInSeconds = Math.round(webkitTimestamp / 1000000) - 11644473600
return new Date(dateInSeconds * 1000)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment