Reputation: 36947
Ok, this may be a simple question, maybe I am thinking about this all wrong. Who knows.
Anyway, I am using Zend Framework and I am attempting to use cookies for the first time in it. So from my understanding cookies in Zend use a format like:
Wednesday, 28-Feb-05 20:41:22 UTC
for the expires. So I am trying to figure out how to take time()
and convert it to a similar date()
variation of the above that is 2 hours in the future and UTC. But like I said I think I am over thinking it, so I need confirmation.
My thoughts is
$cookie_expire = time()+7200;
$cookie_expire = date('l, d-M-y H:i:s Z', $cookie_expire);
And I wanna say this is correct, however something in my head doesn't sit well with the notion so, hopefully someone can tell me if I am off on the idea or not.
Upvotes: 0
Views: 941
Reputation: 2300
http://php.net/manual/en/function.gmdate.php
See the comment by Glen @ 4-Dec-2007 04:32:
This routine can help obtain a UTC timestamp:
<?php
$utc_str = gmdate("M d Y H:i:s", time());
$utc = strtotime($utc_str);
?>
Replace the time()
with the timestamp you want to convert.
Upvotes: 1