Make the time readable : Date Get « Date Time « JavaScript DHTML






Make the time readable

  

<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
function gettime() {
    var date= new Date();
    var hr = date.getHours();
    var m = date.getMinutes();
    var s = date.getSeconds();
    if(m < 10)
    {
        m = "0" + m
    }
    if(s < 10)
    {
        s = "0" + s
    }
    document.clockform.clock.value = hr + ":" + m + ":" + s;
    setTimeout("gettime()",100)
}

</script>
</head>
<body onload="gettime()">
<form name="clockform">
<input type="text" name="clock">
</form>
</body>
</html>

   
    
  








Related examples in the same category

1.Get Day
2.Get Seconds
3.Get Month
4.Get Milliseconds
5.Get Full Year
6.Get Year
7.Get Time
8.To Date Source
9.Convert Date to Locale String()
10.Value Of a Date
11.Readable date value
12.Output date and time in a human readble form
13.Local time and local date
14.Use toPrecision to set the date precision