By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,623 Members | 1,892 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,623 IT Pros & Developers. It's quick & easy.

GMT/UTC help

P: n/a
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?
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
JRS: In article <3a************************@posting.google.com>, seen
in news:comp.lang.javascript, john <jb*****@gtcocalcomp.com> posted at
Mon, 8 Sep 2003 07:41:55 :-
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.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.