Answer the question
In order to leave comments, you need to log in
How to register that the cookie would be exhibited once an hour?
With this code, cookies are set once a day, but once an hour, as I understand it, what needs to be fixed here (days*24*60*60*1000)
, but I don’t know what exactly. Can you help me figure out what each number stands for?
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question