How to get cookie expiration date / creation date from javascript? [duplicate]

It's impossible. document.cookie contains information in string like this:

key1=value1;key2=value2;...

So there isn't any information about dates.

You can store these dates in separate cookie variable:

auth_user=Riateche;auth_expire=01/01/2012

But user can change this variable.


The information is not available through document.cookie, but if you're really desperate for it, you could try performing a request through the XmlHttpRequest object to the current page and access the cookie header using getResponseHeader().


It's now possible with new chrome update for version 47 for 2016 , you can see it through developer tools on Storage > Cookies under the Application tab enter image description here, select cookies and look for your cookie expiration date under "Expires/Max-age"