Re: deleting cookies and local browser time versus server time



lawpoop@xxxxxxxxx wrote in news:0ba47cb1-6fbe-44ae-b328-b4415bf387b1
@d21g2000prf.googlegroups.com:

Hello all -

Is there a way to get the local time from the user's browser? I didn't
see anything in the $_SERVER array.

Well, considering you're asking the $_SERVER for a local user variable,
it won't be there.

That should also raise a flag for you - since PHP is parsed on the
server, you in fact have no way of determining your user's local time
using PHP.


For unsetting cookies, the PHP documentation page for cookies
recommends setting the expiration date to a point in the past.
However, I'm running into problems with time conflicts. Our server is
in a different time zone than the browser I'm developing on. I would
like to go in five-minute increments to test my code after the cookie
expires, and it took me forever to figure out why my cookies weren't
expiring in five minutes.

Don't involve the user local time at all. Put the server time in a
variable, and test THAT number in 5 minute increments.


It's not a big deal because it's only a few hours, so I can set the
time back several hours when we actually go into production. Of
course, hard coding any time could fail, is the user is halfway around
the world. So ideally I could look at the browser's local time, and
set the cookie back appropriately.

Again, PHP knows nothing about the browser client.



.



Relevant Pages

  • Re: getutcdate() issues
    ... If your server has incorrect local time, ... I still fail to understand why this is the database engine's fault. ... them with the correct system clock. ...
    (microsoft.public.sqlserver.programming)
  • Re: Day Light Savings time changes on March 11
    ... An ISP starts out with one mail server and a management server, they create tools that automate and report on the system. ... It is all in local time. ... We will convert them, but it takes and plan, and a reason. ... logo change for Memorial Day. ...
    (freebsd-questions)
  • Re: Date problem
    ... the server is reporting that it's 7/27/09. ... javascript is the only way. ... browser, then he could set up a javascript program to automatically ... report back to the server what the local time at the browser is - ...
    (comp.lang.php)
  • Re: datetime conversions - US CST
    ... I would convert local time to universal time on the ... No matter what server you are on, or how many you pass thru, the time will ... >> universal time to local time which will be CST. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: deleting cookies and local browser time versus server time
    ... Our server ... is in a different time zone than the browser I'm developing on. ... How can I test cookie expiration with that? ...
    (comp.lang.php)