What is the meaning of using "days*24*60*60*1000" in cookie?

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()"> 
0

2 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

2

Cookies 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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like