JSFiddle - React, Tailwind, and code Playground
by basti1012
HTML
<div id="uhr">
</div>
CSS
#uhr{
text-align:center;
font-size:25px;
color:red;
}
JavaScript
function clock() {
var weekdays = new Array("Sonntag","Montag","Dienstag", "Mittwoch","Donnerstag","Freitag","Samstag");
var now = new Date();
var day = now.getDate();
var month = now.getMonth() + 1;
var year = now.getFullYear();
var weekday = now.getDay();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
var day0 = ((day < 10) ? "0" : "");
var month0 = ((month < 10) ? ".0" : ".");
var hours0 = ((hours < 10) ? "0" : "");
var minutes0 = ((minutes < 10) ? ".0" : ":");
var seconds0 = ((seconds < 10) ? ".0" : ":");
var output = weekdays[weekday] + ", " + day0 + day + month0 + month + "." + year + ", " + hours0 + hours + minutes0 + minutes + seconds0 + seconds + " Uhr";
document.getElementById('uhr').innerHTML = output;
}
setInterval(function(){clock()}, 1000);