Re: Date problem
- From: spambait@xxxxxxxxxx (Doug Miller)
- Date: Thu, 23 Jul 2009 13:26:56 GMT
In article <6cd71aa5-e87e-4da2-b526-015cd8d5abb3@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, "C. (http://symcbean.blogspot.com/)" <colin.mckinnon@xxxxxxxxx> wrote:
On Jul 23, 8:17=A0am, JC <ja...@xxxxxxxxxxxxxxxxxxx> wrote:
Unless you want to do clever IP location on the server to find the...
time zone of the client, javascript is the only way.
On Jul 23, 7:01=A0am, "Charles Lavin" <x...@xxx> wrote:
I'm having a problem with dates that I can't seem to find a solution to=
How do I get a Web page to display the current date (and time) OF MY BROWSER
on the page?
First, please don't crosspost.
??
The headers of both the original message, and the reply that you responded to,
show only one group: comp.lang.php.
The OP hasn't explained their problem very clearly - but then if
Charles understood the right questions to ask, he probably would have
known how to find the answers.
In my comments below, read "won't work" as "cannot be depended on to work
reliably".
As far as I am aware, the browser does not notify the server what
locale they are in, nor, specifically, what timezone. However if he
really wants to show the the time appropriate to the timezone of the
browser, then he could set up a javascript program to automatically
report back to the server what the local time at the browser is -
Won't work. User may have scripting disabled.
Even if scripting is enabled, it still won't work, as the date, time, time
zone, or any combination of the three may be set incorrectly on the client
machine.
There are multiple circumstances in which that could happen that do *not*
assume the owner of the client machine to be a clueless idiot incapable of
setting his machine correctly. I can think of at least four.
then, allowing for clock drift, it would be possible to estimate the
timezone offset and push this back to the browser as a cookie or store
it in the session.
Won't work. Different parts of the world have different rules for when
daylight saving time begins and ends, and it's not possible to know reliably
where the user is. Nor is it possible to know if the time zone setting on the
client machine bears any predictable relationship to the time zone in which
the machine is physically located.
Alternatively he could just ask the user what
timezone they are in.
Won't work. User may not know what timezone he's in -- perhaps he's
travelling, and isn't sure. User may not care. User may give incorrect answer,
either intentionally or inadvertently. User may decide "this is ridiculous,
I'm going to some other site that's easier to use and doesn't ask these
useless questions."
Having got this information, it would then be possible to calculate
the user's local time and write this to the browser (RTFM for
date_timezone_set()) - unless (see below) he has a specific
requirement to report the server's time translated to the browsers
timezone, it would be a lot simpler just to use Javascript.
Won't work. As noted above, scripting may be turned off.
OTOH, if he wants to report time very accurately, then he should be
hooking his server into an upstream NTP provider and running a clock
synchronization / drift analysis daemon (e.g. xntpd) then following
the steps above to get the local time at the browser.
Won't work. There's no way to know reliably what time zone the client is in.
.
- Follow-Ups:
- Re: Date problem
- From: Captain Paralytic
- Re: Date problem
- From: Charles Lavin
- Re: Date problem
- References:
- Date problem
- From: Charles Lavin
- Re: Date problem
- From: JC
- Re: Date problem
- From: C. (http://symcbean.blogspot.com/)
- Date problem
- Prev by Date: www.iofferkicks.net Ed hardy,(tshirt$13,bikini$13 swim strunk$25,jean$30,handbag$34,cap$13,sunglass$12)nike shoes:$32,handbag:$35,NFL:$20,jean:$30,air force one shoes,lv,gucci,D&G,bbc,coachUGG boot:$50,.free shipping!
- Next by Date: Re: how to escape a ' to pass on to the shell and then mysql
- Previous by thread: Re: Date problem
- Next by thread: Re: Date problem
- Index(es):
Relevant Pages
|
Loading