refresh client side time and server side time

Discussion in 'ASP General' started by John Davis, Aug 19, 2003.

  1. John Davis

    John Davis Guest

    This code will return the client's current time. But how to refresh the time
    automatically?

    <SCRIPT LANGUAGE=VBSCRIPT>
    Document.Write Time
    </SCRIPT>

    What if I want to refresh the server's current time? Is this client side's
    job or server side's job??
    <%= Time %>

    Thanks!
    John Davis, Aug 19, 2003
    #1
    1. Advertising

  2. > But how to refresh the time automatically?

    This is usually done with a java timer on the client if
    you want it updated every second. Ask in a java group or
    check the docs for the exact syntax.

    >What if I want to refresh the server's current time?


    In the Window_onLoad event you can store the server's time
    in a local variable;

    dtTime = CDate("<%=Now%>")

    Then set a timer up to fire every second which increments
    this local variable by a second using DateAdd. Ask any
    follow-ups in a client-script group.
    Adrian Forbes - MVP, Aug 19, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page