My time is updating in realtime with the following function:
var nIntervId;
function updateTime() {
nIntervId = setInterval(flashTime, 1000*2);
}
function flashTime() {
var now = new Date();
var h = now.getHours();
var m = now.getMinutes();
var s = now.getSeconds();
var time = h + ':' + m;
$('.time').html(time);
}
$(function() {
updateTime();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<span class="time" style="margin-left:20px"></span>
Problem ist, that it is displaying 11:9
instead if 11:09