JSFiddle - React, Tailwind, and code Playground
by Tom DeBerardine
JavaScript
function clockTick() {
var currentTime = new Date(),
month = currentTime.getMonth() + 1,
day = currentTime.getDate(),
year = currentTime.getFullYear(),
hours = currentTime.getHours(),
minutes = currentTime.getMinutes(),
seconds = currentTime.getSeconds(),
text = (month + "/" + day + "/" + year + ' ' + hours + ':' + minutes + ':' + seconds);
var div = document.getElementsByTagName("div")[0];
div.innerHTML = text;
}
setInterval(clockTick, 1000);