Saeed ur Rehman
Saeed ur Rehman

Reputation: 737

How to show a running time with seconds in c# web form application on a label?

How to show a running time with seconds in c# web form application on a label? I tried to find it but unfortunately failed. However I found help for the win form application but not for web form. Any help would be appreciated.

Upvotes: 0

Views: 481

Answers (2)

Surya
Surya

Reputation: 183

For the web page you should use javascript/jquery to show or calculate the time: Here is an example:

<!DOCTYPE html>
<html>
<body>

<p>A script on this page starts this clock:</p>

<p id="demo"></p>

<script>
var myVar = setInterval(myTimer, 1000);

function myTimer() {
    var d = new Date();
    document.getElementById("demo").innerHTML = d.toLocaleTimeString();
}
</script>

</body>
</html>

Upvotes: 1

X.Otano
X.Otano

Reputation: 2169

You shoul use Javascript if you want the timer in the client side (browser).

For example: http://flipclockjs.com/

Upvotes: 1

Related Questions