<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="clock">
<div class="container">
<p id="day"></p>
<p id="hour"></p>
</div>
</div>
<script>
window.onload = function Time() {
var clock = new Date();
var d = clock.getDay();
var h = clock.getHours();
var m = clock.getMinutes();
var s = clock.getSeconds();
function setTime(x) {
if (x < 10) {
x = "0" + x;
}
return x;
}
m = setTime(m);
s = setTime(s);
var days = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
];
setInterval(Time, 1000);
document.getElementById("day").innerHTML = "Today is: " + days[d];
document.getElementById("hour").innerHTML =
"Times is:" + h + ":" + m + ":" + s;
};
</script>
</body>
</html>