<html>
<head>
<title>Date and time of display system dynamically in web pages</title>
<script language="JavaScript">
function startTime() {
var today = new Date(); //Define the date object
var yyyy = (); //Return year through the getFullYear() method of the date object
var MM = () + 1; //Return year through the getMonth() method of the date object
var dd = (); //Return year through the getDate() method of the date object
var hh = (); //Return hour through the getHours method of the date object
var mm = (); //Return minutes through the getMinutes method of the date object
var ss = (); //Return seconds through the getSeconds method of the date object
// If the value of minutes or hours is less than 10, add 0 before its value. For example, if the time is 3:20:9 pm, 15:20:09 is displayed
MM = checkTime(MM);
dd = checkTime(dd);
mm = checkTime(mm);
ss = checkTime(ss);
var day; //Used to save the week (getDay() method gets the week number)
if (() == 0) day = "Sunday"
if (() == 1) day = "Monday"
if (() == 2) day = "Tuesday"
if (() == 3) day = "Wednesday"
if (() == 4) day = "Thursday"
if (() == 5) day = "Friday"
if (() == 6) day = "Saturday"
('nowDateTimeSpan').innerHTML = yyyy + "-" + MM + "-" + dd + " " + hh + ":" + mm + ":" + ss + " " + day;
setTimeout('startTime()', 1000); //Reload the startTime() method in every second
}
function checkTime(i) {
if (i < 10) {
i = "0" + i;
}
return i;
}
</script>
</head>
<body onload="startTime()">
OS TIME:<font color="blue"><span ></span></font>
</body>
</html>