Posts Tagged ‘Calender in java script’

How to display current time using javascript?

How ro create a Javascript clock?

Most of the websites are shown current time on top or bottom. But if we want to display updated time that means updated by each seconds, we can implemented JavaScript timer for the same. In some of the case we need to display count time or stopwatch have to display on our website, that time also we can implement same technique.

 Javascript code for dynamic timer.

Below are the javascript codes for timer. There is a default function setTimeout available in javscript for repeated execution for a particular period.

<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;

<body onload="startTime()" bgcolor="blue">
<div id="timeDiv"></div>

%d bloggers like this: