Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> JavaScript >> Snippet

Create expiration date



var expireDate = new Date ()      //set date to current date-time

var days = 2     // number of days til expiration

var extra = days * 24 * 60 * 60 * 1000    //  days worth of milliseconds

expireDate.setTime( expireDate.getTime + extra  )

document.cookie = CookieName + "=" + CookieValue + ";expires=" + expireDate.toGMTString() + ";"

Note :  expiration date must be in GMT time