kla0005 Posted January 28, 2010 Share Posted January 28, 2010 Yo Guys, I have this code: $expire=time()+60*60*24*30; setcookie("cookie_name", "Cookie text", $expire); - What should i do to make the $expire to one hour, and one minute? - so i have a cookie that expires after 1 minute, and another that expires after 1 hour? Thanks Link to comment https://forums.phpfreaks.com/topic/190132-cookies/ Share on other sites More sharing options...
premiso Posted January 28, 2010 Share Posted January 28, 2010 $expire_hour = time()+60*60; $expire_min = time()+60; Link to comment https://forums.phpfreaks.com/topic/190132-cookies/#findComment-1003176 Share on other sites More sharing options...
kla0005 Posted January 28, 2010 Author Share Posted January 28, 2010 Thanks ! =D - But what if i want it to be 1½ hour and not just one? Link to comment https://forums.phpfreaks.com/topic/190132-cookies/#findComment-1003180 Share on other sites More sharing options...
premiso Posted January 28, 2010 Share Posted January 28, 2010 - But what if i want it to be 1½ hour and not just one? Can you not perform basic math? The 60 is the seconds, so time()+60 (seconds) is 1 minute ahead. Times that by another 60 it becomes an hour, so if you want it to be an hour and a half you can do 60 seconds times 90, which would make 90 minutes or an hour and a half. Link to comment https://forums.phpfreaks.com/topic/190132-cookies/#findComment-1003186 Share on other sites More sharing options...
kla0005 Posted January 28, 2010 Author Share Posted January 28, 2010 - But what if i want it to be 1½ hour and not just one? Can you not perform basic math? The 60 is the seconds, so time()+60 (seconds) is 1 minute ahead. Times that by another 60 it becomes an hour, so if you want it to be an hour and a half you can do 60 seconds times 90, which would make 90 minutes or an hour and a half. I like u to<3 - Sorry, i have never seen a 90 in a cookie turtorial before, so i thought that 60 was max.? Link to comment https://forums.phpfreaks.com/topic/190132-cookies/#findComment-1003188 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.