7.07.2011

HTML Code to show time & date

Below is the HTML Code which shows Time. Just you need to place the code in HTML/JavaScript widget at your desired place in your blog.

<script>
atoj = new Date();
atoj1= atoj.getHours();
atoj2 = atoj.getMinutes();
atoj3= atoj.getSeconds();



if(atoj1==0){atoj4=" AM";atoj1=12}
else if(atoj1 <= 11){atoj4=" AM"} else if(atoj1 == 12){atoj4=" PM";atoj1=12} else if(atoj1 >= 13){atoj4=" PM";atoj1-=12}


if(atoj2 <= 9){atoj2="0"+atoj2} document.write(""+atoj1+":"+atoj2+":"+atoj3+""+atoj4+""+"");
</script>

Below is the HTML Code which displays date in this format DD/MM/YY. Just you need to place the code in HTML/JavaScript widget at your desired place in your blog.

<script language="Javascript">
<!--


var now = new Date


document.write(now.getDate() + "/" + now.getMonth() + "/" + now.getYear())


//-->
</script>

No comments:

Post a Comment