Is it client time or server time?

Here is a bunch of code from a certain site;

<script type="text/javascript">

    function ShowTime() {

        var dt = new Date();

        document.getElementById("<%= TextBox1.ClientID %>").value = dt.toLocaleTimeString();

        window.setTimeout("ShowTime()", 1000);



I am confuse if the ShowTime function returns server time or client’s time.
However, I know that javascript executes in the client side.

You are right. JS executes client side, so that will return client time

So how am I be able to pull the server time through JS? I am currently using an ajax timer and for each seconds the browser keeps on refreshing.

You going to have to replace your code with this:

document.getElementById(“<%= TextBox1.ClientID %>”).value = ‘<%=DateTime.Now.ToString(“YourFormatHere”) %>’;

Although I don’t know how this is going to tie in to your ajax timer, I have never used that