To Display Current Date and Time

Susanthampy
Posted by Susanthampy under JavaScript category on | Points: 40 | Views : 2368
<html>
<body>

<script type="text/javascript">

function checkTime(i)
{
if (i<10)
{
i="0" + i;
}
return i;
}

var d = new Date();
document.write("Current Time <br />");
document.write(checkTime(d.getHours()));
document.write(":");
document.write(checkTime(d.getMinutes()));
document.write(":");
document.write(checkTime(d.getSeconds()));
document.write(d);
</script>

</body>
</html>

Comments or Responses

Login to post response