Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cookies expiration time format

I created DB from google chrome's Cookies file and one of the columns in the cookies table is expires_utc. The format of the column is like - 13169399213145330, which is more like unix time. But when i'm trying to use unix time converter, it gives wrong values.

So, what format is that and how i can convert it to actually unix time?

like image 218
Src Avatar asked Apr 20 '17 11:04

Src


People also ask

How do I set cookie expiry time?

You can extend the life of a cookie beyond the current browser session by setting an expiration date and saving the expiry date within the cookie. This can be done by setting the 'expires' attribute to a date and time.

How do you read the expiration date on cookies?

Right-click anywhere on a web page, on the website where you want to check the cookie expiration date. Then, open up the developer tools by selecting Inspect or Inspect element, depending on the browser.

What is the expiration time in cookies?

Cookies typically expire somewhere between 30 and 90 days. Though, some companies do implement shorter cookie expiration dates. It's also important to note that cookies can be deleted manually by the user or through third-party security programs. The cookie expiration time is very important.

Is it necessary to write expiry date in cookies?

Expiration and RemovalA cookie with no expiration date specified will expire when the browser is closed. These are often called session cookies because they are removed after the browser session ends (when the browser is closed). Cookies with an expiration date in the past will be removed from the browser.


1 Answers

So, after long researches on this topic, here is the solution:

  • Chrome's cookies timestap's epoch starts 1601-01-01T00:00:00Z (Why? Because.)

So, it's 11644473600 seconds before the UNIX epoch. To convert chrome's timestamp to UNIX, you need to:

  1. Devide the actual timestamp (in my case it's expires_utc column in cookies table) by 1000000 // And someone should explain my why.
  2. Subtract 11644473600
  3. DONE! Now you got UNIX timestamp.
like image 113
Src Avatar answered Nov 09 '22 04:11

Src