JSFiddle - React, Tailwind, and code Playground

by Alexander Startsev

HTML

<html>
<head>
<title>Время</title>
</head>
<body onLoad="myclock();">
    <div id="timer"></div>
</body>
</html>

CSS

#timer{
    font-family: Tahoma;
    font-size: 50px;
    color: #777;
}

span{
    padding: 0 10px;
}

JavaScript

function myclock()
{
var ndata = new Date(),
hours = ndata.getHours(),
mins = ndata.getMinutes(),
secs = ndata.getSeconds();

hours = (hours < 10) ? "0" + hours : hours;
mins = (mins < 10) ? "0" + mins : mins;
secs = (secs < 10) ? "0" + secs : secs;

datastr = hours + "<span></span>" + mins + "<span></span>" + secs;
document.getElementById('timer').innerHTML = datastr;
setTimeout("myclock()", 1000);
}