tags:

views:

18

answers:

1

How to set this cookie to expire in one hour from the current time:

document.cookie = 'username=' + value; + 'expires=' + WHAT GOES HERE?; + 'path = /';
+2  A: 
var now = new Date();
var time = now.getTime();
time += 3600 * 1000;
now.setTime(time);
document.cookie = 
    'username=' + value + 
    '; expires=' + now.toGMTString() + 
    '; path=/';
Darin Dimitrov