Re: Date problem



Hi --

I am assuming that I have several clueless idiots running around my Web
site. The fact that many of these users seem incapable of realizing that the
times are always a fixed number of hours off -- even after I tell them so --
just strengthens that assumption. :)

I also know that, because we have some amount of control over these PCs,
their clocks are being synchronized with some regularity to one of several
servers. So I can be more confident of the PC having the correct time and
timezone set than I can be of the user knowing what time zone (s)he's in, or
even what a time zone is.

Tnx
CL


"Doug Miller" <spambait@xxxxxxxxxx> wrote in message
news:h49oev$hqk$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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.


.



Relevant Pages

  • Re: Date problem
    ... time zone of the client, ... As far as I am aware, the browser does not notify the server what ... locale they are in, nor, specifically, what timezone. ... Nor is it possible to know if the time zone setting on the ...
    (comp.lang.php)
  • Re: how to make dates without timezones?
    ... Date it automatically assigns the timezone. ... with 0 hours, 0 minutes, 0 seconds and the time zone of the server. ... My application is a client server app using rmi. ...
    (comp.lang.java.programmer)
  • RE: How do I generally set a TimeZone for the application session
    ... You can't set the current time zone through managed code, ... We are looking into adding timezone features for future versions of the ... | I want my .NET Windows Form client to be executing with the same TimeZone ... | Daylight setting as we have on the server. ...
    (microsoft.public.dotnet.framework)
  • Re: Date problem
    ... Right now, the page generates the date and time local to the Web server, ... How do I get the page to display the correct date and time for the time zone ... the browser happens to be sitting in? ... Unless you have control over the configuration of the client, ...
    (comp.lang.php)
  • Re: how to make dates without timezones?
    ... Date it automatically assigns the timezone. ... with 0 hours, 0 minutes, 0 seconds and the time zone of the server. ... My application is a client server app using rmi. ...
    (comp.lang.java.programmer)