Tanker
10-11-2002, 06:01 PM
I want to set a cookie that will expire at midnight the following day...
Say I goto the site, It sets a cookie to last until the next day at midnight, The cookie is set at 1140am on Tue the 4th, it should expire at 1159pm on Wed the 5th.
I think im close but i've never been good with dates. Any help would be appreciated.
function cookie_24(cookieName,cookieValue){
var now = new Date();
now.setTime(now.getTime() + 1 * 24 * 60 * 60 * 1000);
expire=new Date(now).toGMTString()
document.cookie = cookieName + "=" + cookieValue + "; expires=" + expire + "; path=/;"
}
Say I goto the site, It sets a cookie to last until the next day at midnight, The cookie is set at 1140am on Tue the 4th, it should expire at 1159pm on Wed the 5th.
I think im close but i've never been good with dates. Any help would be appreciated.
function cookie_24(cookieName,cookieValue){
var now = new Date();
now.setTime(now.getTime() + 1 * 24 * 60 * 60 * 1000);
expire=new Date(now).toGMTString()
document.cookie = cookieName + "=" + cookieValue + "; expires=" + expire + "; path=/;"
}