What is the meaning of using days * 24 * 60 * 60 * 1000 in a cookie?
I've seen it quite a lot and I don't understand what it means.
I need to create a function that reads the cookie and puts the value in a text box while uploading the page.
<body onload="readCookie()"> 02 Answers
Basically, 1000 is used here just for converting seconds to milliseconds.
Number of seconds in a day = 24 * 60 * 60 = 86400 seconds.
1 second = 1000 milliseconds.
So after calculating the expression, the result is in milliseconds.
days * 24 * 60 * 60 * 1000 = days * 86400000 ms
2Cookies can be set with an “expiry date”, and that is given in milliseconds.
Days * 24 * 60 * 60 * 1000 is therefore the milliseconds in a day – 1000 milliseconds * 60 seconds * 60 minutes * 24 hours * days
0