Demo
Code
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
function showTime()
{
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
// add a zero in front of numbers<10
h=checkTime(h);
m=checkTime(m);
s=checkTime(s);
$("#clock").text(h+":"+m+":"+s);
t=setTimeout('showTime()',1000);
}
function checkTime(i)
{
if (i<10)
{
i="0" + i;
}
return i;
}
</script>
<body onload="showTime()">
<div id="clock"></div>
</body>
Code
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
function showTime()
{
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
// add a zero in front of numbers<10
h=checkTime(h);
m=checkTime(m);
s=checkTime(s);
$("#clock").text(h+":"+m+":"+s);
t=setTimeout('showTime()',1000);
}
function checkTime(i)
{
if (i<10)
{
i="0" + i;
}
return i;
}
</script>
<body onload="showTime()">
<div id="clock"></div>
</body>
Thanks I was looking for this.
ReplyDeletei want the code where the timer starts from 00:00:00 when the user logged in to the system...pls..
ReplyDeleteHi Please refer the below link
ReplyDeletehttp://www.knowlbase.in/p/counter.html
Ya...this is exactly what i need...thank u very much...
Deletecan i store its present value when a user logouts...?
helllo plss help i have a login time like 04:25:13 and a log out time like 04:26:29 and i want to find the login duration whose output will be like 00:01:16....anybody have the script for this...?
ReplyDeleteThanks Buddy :)
ReplyDeletei want to remove seconds and show AM/PM ! please help
ReplyDelete