Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- Cookie expiry time


Fotiman - 11:48 pm on May 28, 2012 (gmt 0)


toGMTString is deprecated and should not be used. Use toUTCString instead.
Instead of setDate, use setTime:

exdate.setTime(exdate.getTime() + (1000 * 60 * 60 * 24 * expiredays));

setTime takes a value in ms, and getTime returns a value in ms. So get the current time in ms, then multiply your expiredays value by 24 to get the number of hours, multiply that by 60 to get the number of minutes, multiply that by 60 to get the number of seconds, and multiply that by 1000 to get the number of ms. Then, as I mentioned, use toUTCString instead of toGMTString.

Hope that helps.


Thread source:: http://www.webmasterworld.com/javascript/4457927.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com