JSFiddle - React, Tailwind, and code Playground
by Alfie
HTML
<div id="time"></div>
JavaScript
$(document).ready(function() {
function startTime() {
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var s = today.getSeconds();
$('#time').text(twelve(h) + "|" + m + "|" + s);
setTimeout(function(){startTime()},500);
}
startTime();
function twelve(h){
if ( h > 12) {
h = h - 12;
}
return h;
}
});