GMT/UTC help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • john

    #1

    GMT/UTC help

    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?
  • Dr John Stockton

    #2
    Re: GMT/UTC help

    JRS: In article <3a3d008.030908 0641.c6ac941@po sting.google.co m>, seen
    in news:comp.lang. javascript, john <jbenson@gtcoca lcomp.com> posted at
    Mon, 8 Sep 2003 07:41:55 :-[color=blue]
    >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.[/color]

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

    [color=blue]
    > 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).[/color]

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

    [color=blue]
    > 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?[/color]

    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.
    [color=blue]
    > (I don't really want
    >to use PHP, either). Or, how can I set the javascript to start at the
    >server time?[/color]

    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.demo n.co.uk/js-index.htm> JS maths, dates, sources.
    <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.

    Comment

    Working...