The Little Guy Posted April 11, 2008 Share Posted April 11, 2008 I need to make a cookie (Must use JavaScript NOT PHP), and I need it to expire 24 hours after the cookie is created, how can I do that? I am using: var today = new Date(); to get the date, how do I add 24 hours to that? Quote Link to comment Share on other sites More sharing options...
haku Posted April 11, 2008 Share Posted April 11, 2008 var today = new Date() + (60 * 60 * 24) Either that or var today = new Date() + (60 * 60 * 24 * 1000) (I think Date is in milliseconds, so it should be the second one). Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted April 11, 2008 Author Share Posted April 11, 2008 Thanks it work great! after some mods Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.