Sunday 16 March 2014

Display Current Time on Page using Javascript

Display Current Time on Page using Javascript

Use the following Code-Snippet to display Current Time using Javascript...

<script type="text/javascript">
function startTime()
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
// add a zero in front of numbers<10

function checkTime(i)
if (i<10)
  i="0" + i;
return i;
<title>Display Current Time</title>
<body onload="startTime()">
<div id="txt"></div>

No comments:

Post a Comment

Thank You for Your Comments. We will get back to you soon.

back to top