The following code is used to set a cookie that will expire after one hour

setcookie('cookieName', 'cookieValue', time()+3600, '/');

if I want to set a cookie that should never expire, what I have to do?


12 Years
Discussion Span
Last Post by paradox814

Simple solution - set the time stamp to 10years later! Not many people will use a computer that long this day. Disk clean up or installing new browser version will also delete your cookies anyway.


i agree, I have some cookies on my computer that are set to expire on Tuesday, June 02, 2037 1:02:03 PM

that one in particular was set by yahoo, I have another one by google that is set to expire on Sunday, January 17, 2038 4:00:00 PM so as long as you set it to some ridiculous long time in the future, you will bet set.

heck I even have one from daniweb.com that is set until Sunday, January 17, 2038 4:00:00 PM


Sunday, January 17, 2038 4:00:00 PM ? Is there something special about this date?

I doubt it, what it probably is, is that they use the same advertising companies (ie: advertising.com, etc...) and they advertiser sets the cookie but who knows

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.