I'm trying to set a PHP cookie to expire 1 Year from when the user logged in, and I'm doing it this way:
setcookie("myCookie",'exampleUserName',(365 * 24 * 60) ,'/');
The problem is, when I view the cookie using the console in Chrome or Firefox, it show Expires Sun, 05, 2014
in Chrome and Expires = Session
in Firefox.
Any other site like Google or stackoverflows cookies show the correct expiration date.
How can I set this right?
365 * 24 * 60
is missing a factor of60
and must be added totime()
, it's as simple as that.