
Introduction
<script language="javascript">
function showTime()
{
now=new Date();
var hour=now.getHours();
var min=now.getMinutes();
var sec=now.getSeconds();
if (min<=9) { min="0"+min; }
if (sec<=9) { sec="0"+sec; }
if (hour<10) { hour="0"+hour; }
if (hour>12)
{ hour1= hour - 12;}
else
hour1 = hour;
if (hour1<10) { hour1="0"+hour1; }
var ctime = hour1 + ":" + min + ":" + sec;
LABEL1.innerText= ctime;
setTimeout("showTime()", 1000);
}
</script>
The above code diplayes the time in a label control named LABEL1.
you can create a simple html page and add a label and name it LABEL1.
Then add the above script into header section of the html.
Try accessing the page. You can also down load the sample code.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here