Skip to content

Instantly share code, notes, and snippets.

@lindekaer lindekaer/convert.ts

Last active Aug 9, 2019
Embed
What would you like to do?
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
You can’t perform that action at this time.