<html>
<body>
<h1>JavaScript Dates</h1>
<p>Add zeros and colons to display the time:</p>
<p id="demo"></p>
<script>
function addZero(i) {
if (i < 10) {i = "0" + i}
return i;
}
const d = new Date();
let h = addZero(d.getHours());
let m = addZero(d.getMinutes());
let s = addZero(d.getSeconds());
let time = h + ":" + m + ":" + s;
document.getElementById("demo").innerHTML = time;
</script>
</body>
</html>