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? Link to comment https://forums.phpfreaks.com/topic/100662-24-hours-later/ 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). Link to comment https://forums.phpfreaks.com/topic/100662-24-hours-later/#findComment-514796 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 Link to comment https://forums.phpfreaks.com/topic/100662-24-hours-later/#findComment-514953 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.