MeerKat - If what you say is true (that time() returns a GMS timestamp and
not a timestamp that is the servers own timezone time), then it must follow
that the date() function must do an automatic timezone conversion to local
time. For when I do an
echo date("l dS of F Y h:i:s A",time());
on my localhost, I get exactly my current local timezone time, NOT GMT. But
I don't see any mention of this auto-conversion to local time zone
functionality in the DATE() function documentation.
Certainly time() DOES return the GMS timestamp - I don't doubt that. It's
just that I've been using examples of the above on my localhost and 3-hr
different timezone server and had it firmly in my mind that time() was
reporting local server time because those were the times I was getting,
under the date() transformation.
My php manual states, under date():
Returns a string formatted according to the given format string using the
given integer timestamp or the current local time if no timestamp is given.
The phrase "or the current local time if no timestamp is given" implies to
me that when a timestamp IS given, it would just report the GMS time, since
that's what a 'real' timestamp is. But it doesn't, evidently. It takes a GMS
timestamp and reports local time. Is this your understanding?
thanks,
dg
"MeerKat" <li****************@blueyonder.co.uk> wrote in message
news:KA*****************@news-binary.blueyonder.co.uk...
Cookies can be evil at times :)
Two facts:
1. The only legal timezone allowed for a cookie is GMT, no matter where
the server lives.
2. time() returns the number of seconds since 01/01/1970 00:00:00 GMT.
Now, I've not done any tests, but I belive that the browser itself will
determine what timezone it is in and will decide on whether to purge the
cookie -after- converting from GMT to its own timezone.
So, I believe that you're safe doing what you are doing and you
shouldn't worry about timezones.
Here's Netscape's cookies specification:
http://wp.netscape.com/newsref/std/cookie_spec.html
MK.
dan glenn wrote: Say,
I want to set a cookie and have it expire an hour after it's set. It's
looking like this is only possible for browsers which are in the same
time zone as my server??
In other words, if I set my cookie with:
setcookie('CookieName', $SomeValue, time()+3600, "/");
the cookie should expire 1 hr later. But time() returns the time as it
is at the location of the server. If whoever loads my page is 3 timezones east
of where my server is, the time that I set is already expired as far as
that browser is concerned!
Is this correct or am I completely nuts?
If it is correct, is there any way I can set a cookie based on the
browser machine's time clock, so it will work the way I want no matter where the
browser is located relative to the server?
-dg
--
MeerKat