GMT/UTC help

J

john

On index.htm, I have a basic javascript function that displays the
current times(which is refreshed every second) for Maryland, Arizona,
Germany, and the UK. Now, if someone in Arizona and someone in
Maryland both view the page at the same time, the current times will
differ, based on the client's clock (the server is located in
Maryland). I tried using the UTC javascript function, but this is
also based on the user's clock and will differ. Is there any other
way to display the server time using Javascript? (I don't really want
to use PHP, either). Or, how can I set the javascript to start at the
server time?
 
D

Dr John Stockton

JRS: In article <[email protected]>, seen
in news:comp.lang.javascript said:
On index.htm, I have a basic javascript function that displays the
current times(which is refreshed every second) for Maryland, Arizona,
Germany, and the UK.

For elegance and not omitting to display some of the seconds,
recalculate the timeout each time.

Now, if someone in Arizona and someone in
Maryland both view the page at the same time, the current times will
differ, based on the client's clock (the server is located in
Maryland).

Because of clock error, and also because Arizona is a long way from both
Maryland US and Maryland UK.

I tried using the UTC javascript function, but this is
also based on the user's clock and will differ. Is there any other
way to display the server time using Javascript?

You can display, IIRC, the server time of Heavens-Above (which will be
good) by something based on location.href='www.h-a.com/page.htm'; and
likewise NIST. But, also IIRC, although you can display that in a pop-
up, your own script will be unable to see it. Your human users, though,
would be able to see their own clock errors.
(I don't really want
to use PHP, either). Or, how can I set the javascript to start at the
server time?

If I had seen posted here a way to do it in javascript, one working on a
general server, I'd have put it on one of my pages; I didn't; so there
may well not be one. AIUI, with a Java Applet, things would be
different.

Remember that Germany and the UK start and finish Summer Time
simultaneously, give or take a possible quibble about GMT-UTC; but MD &
AZ in US do it at two different times, and also a week later in Spring.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,086
Latest member
ChelseaAmi

Latest Threads

Top