I use this code to show simple clock on my website:
function showClock() {
var today = new Date(),
h = today.getUTCHours(),
m = today.getMinutes(),
s = today.getSeconds();
h = checkTime(h);
m = checkTime(m);
s = checkTime(s);
$('.hour').html(h);
$('.minutes').html(m);
$('.seconds').html(s);
setTimeout(showClock, 500);
}
function checkTime(i) {
if (i < 10) {
i = "0" + i;
}
return i;
}
I noticed that seconds which getSeconds() function returns are not equal to GMT seconds (I use http://wwp.greenwichmeantime.com/). How can I fix that? Maybe this question is quite strange, but I need your help!:)