Clock in Javascript

<html>
<head>
<script type=”text/javascript”>
function india(){
var  chour;
var cmin;
var csce;
var tv;
var now=new Date();
chour=now.getHours();
cmin=now.getMinutes();
csce=now.getSeconds();
if(chour<10)
{
chour=”0″+chour;

}
if(cmin<10)
{
cmin=”0″+cmin;
}
if(csce<10)
{
csce=”0″+csce;
}
if(chour<12)
{
tv=”am”;
}else{
tv=”pm”;
}
var time=chour +”:”+cmin + “:”+csce + tv;
var tim;
tim=document.getElementById(“time”).innerHTML=time;
}
</script>
</head>
<body onload=”setInterval(‘india()’,200);”>
<div id=”time”></div>
</body>
</html>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s