Click to See Complete Forum and Search --> : Help


babloome
05-01-2003, 07:58 AM
Is this the right way to set a cookie to expire after 1 day?

expirydate = new Date(today.getTime() + (1 * 86400000));
document.cookie = window.location.href + " from " + document.referrer + "; path=/; expires=" + expirydate + ";";

pyro
05-01-2003, 08:11 AM
I would do it something like this:

expirydate = new Date();
expirydate.setDate(expirydate.getDate() + 1); // expire in one day
document.cookie = window.location.href + " from " + document.referrer + "; expires=" + expirydate.toGMTString() + "; path=/;";