Could we display the server time on the client browser ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • giandeo
    New Member
    • Jan 2008
    • 46

    Could we display the server time on the client browser ?

    Hello Experts.

    I wish to set the date and time on my PC which actually i am using as a web server and want users see that date and time when they load my web page and not that is set on their browsers.

    Could you help me out please!
  • shweta123
    Recognized Expert Contributor
    • Nov 2006
    • 692

    #2
    Hi,

    You can use the Now() function for displaying current date and time.
    e.g.
    Code:
      
       <%
          Dim myDateTime
          myDateTime = Now()
       %>
    Now display the above date and time on the page.

    Code:
        <div id= "div1"><%=myDateTime></div>
    Originally posted by giandeo
    Hello Experts.

    I wish to set the date and time on my PC which actually i am using as a web server and want users see that date and time when they load my web page and not that is set on their browsers.

    Could you help me out please!

    Comment

    • giandeo
      New Member
      • Jan 2008
      • 46

      #3
      Originally posted by shweta123
      Hi,

      You can use the Now() function for displaying current date and time.
      e.g.
      Code:
        
         <%
            Dim myDateTime
            myDateTime = Now()
         %>
      Now display the above date and time on the page.

      Code:
          <div id= "div1"><%=myDateTime></div>
      Hi !

      Thank you for you suggestions.
      I have tried the code but it does not work.
      The date and time set on my server is different from that on the browser of the client.
      Anyway, thanks a lot for your help. I will truggling to find out the solution and will definitely publish it here for any one to use in case of need.

      Comment

      • jhardman
        Recognized Expert Specialist
        • Jan 2007
        • 3405

        #4
        Originally posted by giandeo
        Hi !

        Thank you for you suggestions.
        I have tried the code but it does not work.
        The date and time set on my server is different from that on the browser of the client.
        Anyway, thanks a lot for your help. I will truggling to find out the solution and will definitely publish it here for any one to use in case of need.
        Shweta is right. now() returns the server's time, not the client's time.

        Jared

        Comment

        • RamyaSrinath
          New Member
          • Mar 2008
          • 7

          #5
          hi...
          that is what shwetha needs and shwetha please be clear with your question.
          As now() is executed on the server, it returns the server time and that is the answer for your question.

          Comment

          • giandeo
            New Member
            • Jan 2008
            • 46

            #6
            Originally posted by RamyaSrinath
            hi...
            that is what shwetha needs and shwetha please be clear with your question.
            As now() is executed on the server, it returns the server time and that is the answer for your question.
            Hello Experts.
            Thank you so much for your help.
            I tried the code suggested by Shwetha. It works fine.

            Thank you .....

            Comment

            Working...