NYCPHP Meetup

NYPHP.org

[nycphp-talk] How do I create a future date for a cookie?

David Sklar sklar at sklar.com
Thu Sep 4 15:29:37 EDT 2003


Note that many browsers won't deal well with an cookie whose expiration date
is after January 19, 2038 at 3:14:07 A.M. UTC (that's an epoch timestamp of
2147483647) since they store cookie expiration time in a 32 bit signed
integer. (The maximum positive value of a 32 bit signed int is 2147483647).

So, you may be better off with:

setcookie('myCookie',$val,2147483647);


David

On Thursday, September 04, 2003 3:03 PM, mailto:talk-bounces at lists.nyphp.org
wrote:

> well this is what I came up with, it's a kluge but it's the best I
> can think of:
>
> setcookie('myCookie', $val, time() + (86400 * 36500)); // SET TO 100
> YEARS FROM NOW
>
> Phil
>
> ----- Original Message -----
> From: Phil Powell
> To: NYPHP Talk
> Sent: Thursday, September 04, 2003 2:22 PM
> Subject: [nycphp-talk] How do I create a future date for a cookie?
>
>
> I'm using setcookie() that I want to set "permanently" (set it to
> like 100 years from now), but looking up both date() and mktime()
> honestly made no sense to me as to how to do it.
>
> So, um, how do I do it?
>
> Thanx
> Phil
>
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk




More information about the talk mailing list