Jump to content

Convert WebKit/Chrome timestamps


Recommended Posts

Hi guys, i want to convert WebKit/Chrome timestamps that i've found in chrome cookie database to Human-Readable time (if possible, with UTC or GMT offset).

  • Example of WebKit/Chrome timestamp13228999534132232
  • Output that i want: 2020-03-18 20:16:56

This site has a tool to do this work, but i wonder how to convert this time (this timestamp's time bases are 1600/01/01) to human-readable time:

https://www.epochconverter.com/webkit

Edited by Colduction
Link to comment
Share on other sites

  • Developers
35 minutes ago, Colduction said:

Output that i want: 2020-03-18 20:16:56

Think the output should be  "March 18, 2020 10:05:34 AM" GMT according that website and this script should get that:

#include<Date.au3>
$timestamp = 13228999534132232
$sNewDate = _DateAdd('s', Int($timestamp/1000000+.5), "1601/01/01 00:00:00")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sNewDate = ' & $sNewDate & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

#include <Date.au3>
Global $EPOCHtime = 13228999534132232 / 1000000 ; <== microseconds to seconds

Global $aTimeZoneInfo = _Date_Time_GetTimeZoneInformation() ; ***
$EPOCHtime -= $aTimeZoneInfo[1] * 60 ; ***

Global $sDateTime = _DateAdd('s', Int($EPOCHtime), "1601/01/01 00:00:00")
ConsoleWrite('$sDateTime = ' & StringRegExpReplace($sDateTime, "(\d{4})/(\d{2})/(\d{2})", "${1}-${2}-${3}") & @CRLF)

EDIT : Hmm, probably the TimeZone information is even counterproductive here. Comment this part out if necessary, which would then correspond exactly to @Jos suggestion :lol:.

Edited by Musashi

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

7 minutes ago, Nine said:

Glad to see. He changed his avatar, but he is BACK ! 

I've been banned from AutoIt forum, because of delay to answer a question (but i was not online to give answer).

Have you a problem with my account history?

Edited by Colduction
Link to comment
Share on other sites

5 minutes ago, Danp2 said:

@Colduction https://www.autoitscript.com/forum/search/?q=epoch

P.S. In case you couldn't find it, the search box looks like this -- image.png.32d98c361b7cc040d15e05978b633cdd.png

I know that there is a search button in this site, but someone in other forums wrote about Chrome and he divided by 1600xxxx and 1000xxxx, i was think that these topics in AutoIt Forum was not useful 😕 Just this.

Link to comment
Share on other sites

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...