google-chromegoogle-chrome-devtools

How to convert Chrome cookies "expiration_time" to a readable date / time?


On Google Chrome's cookies, the timestamp values are like this :

1765064691

What calculation i need to do in order to convert this integer, to a human readable date / time ?


Solution

  • // Chrome expiration_time as unix timestamp
    let timestamp = 1765064691;
    
    // Convert to milliseconds
    let readableDate = new Date(timestamp * 1000);
    
    // Format date and time
    console.log("UTC:", readableDate.toUTCString()); // UTC time
    console.log("Lokal:", readableDate.toLocaleString()); // locale time
    

    And next time, please try to do some researches on your own. This question is so simple it makes me think that you haven't even tried ;)