Forum Moderators: coopster

Message Too Old, No Replies

PHP Cookie Expiration ... something other then seconds?

I'd prefer to use days for example...

         

JAB Creations

11:24 pm on Mar 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm making my first cookie but I don't want it to expire for say 30 days. Now by default I think it does the expiration time by seconds.... 2592000 would be 30 days?

60secx60minx24x30=2592000 .... Anyway thats my understanding at least.

coopster

11:45 pm on Mar 30, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



That would be a pretty good understanding, the set_cookie() [php.net] example is exactly the same ;)

dcrombie

8:12 am on Mar 31, 2005 (gmt 0)



I would leave it as '86400 x 30' - that's easy for most programmers to recognise as '30 days', wheras '2592000' is fairly meaningless.

;)

dreamcatcher

8:28 am on Mar 31, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could also use:

time()+24*24*30

Which is the equivalent of:

current time+24 = 1hr
* 24 = 24hrs (1 Day)
*30 = 30 Days

dc