Cookies expiring in different timezones
Posted: Sun Sep 11, 2011 11:08 am
Hi everyone,
I'm getting a bit confused about how cookies work in different timezones and wondered if someone could shed some light? I'm using a now() function like CodeIgniter's that works out the current timestamp in GMT:
And I'll be setting cookies based on this time:
If the server sets it to expire on 2011-09-11 19:00:00 (UTC), and let's say the user is UTC-2, will the user's browser interpret the expire time as 2011-09-11 19:00:00 or 2011-09-11 17:00:00? In other words, will they be getting sent before/after they should? I'm hoping the browser will be able to work it out but before I code away I just thought I'd check.
Thanks in advance.
P.S. Apologies if this is the wrong place for the question! I'm not sure if this counts as theory / design ..
I'm getting a bit confused about how cookies work in different timezones and wondered if someone could shed some light? I'm using a now() function like CodeIgniter's that works out the current timestamp in GMT:
Code: Select all
$now = time();
$time = mktime(gmdate('H', $now), gmdate('i', $now), gmdate('s', $now), gmdate('m', $now), gmdate('d', $now), gmdate('Y', $now));Code: Select all
$now = now(); // 2011-09-11 18:00:00 UTC
$expire = $now + 3600; // 2011-09-11 19:00:00 UTC
setcookie('cookie_name', 'cookie_value', $expire);Thanks in advance.
P.S. Apologies if this is the wrong place for the question! I'm not sure if this counts as theory / design ..