Jump to content


This topic is now archived and is closed to further replies.


Cookies omg i dont understand the math?<time()

Recommended Posts

like can someone tell me how 2 set cookies with the specified time and understanding how what time is what. like example

setcookie("id", $user[id],time()+(60*60*24*5), "/", "");

the 60*60*24*5

how does it work?

*as u looked i seen time() so ill look that up plz post thanks.

Share this post

Link to post
Share on other sites
the [code=php:0]time()[/code] function returns
[quote]the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).[/quote]

so if you wanted to go 60 seconds from now
you'd say

[code]time() + 60;[/code]

lets' say you wanted to go and hour later
well, an hour is 60 minutes...and you know one minute is 60 seconds
[code=php:0]time() + (60*60)[/code]

so in your case you're going

[code=php:0]time() + 60 //One minute
time() + (60*60) //One Hour
time() + (60*60*24) //One Day
time() + (60*60*24*5) //Five Days[/code]
hope that helps

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.