Friday, August 10, 2007

JavaScript Program To Display Date and Current Time

<script type="text/javascript">
function TickTick()
var today=new Date()
var dd = today.getDate();
var mm = today.getMonth();
var yy = today.getFullYear();
var h=today.getHours()
var m=today.getMinutes()
var s=today.getSeconds()

document.getElementById('Clock').innerHTML="<strong>"+dd+"-"+mm+"-"+yy+" (dd/mm/yyyy)<br/>"+h+":"+m+":"+s+"</strong>";


function secTicker(i)// This Function is to add zero before minutes and second value which is less than 10
if (i < 10){i = "0" + i}return i; }

<body onload="TickTick()">
<div id="Clock"></div>



No comments:

Creative Commons License
Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.