Всем привет! Есть js таймер, минуты и секунды, но часов нету. Как добавить часы, чтобы было часы, минуты и секунды?
Вот код:
function showTimeLess ()
{
function addZero (x) {return ((x < 10)? '0' : '') + x}
var t = Math.round (.001 * (sessionStorage.getItem ('timeset') - performance.now ()));
document.getElementById ('my_timer').textContent = [addZero (Math.floor (t / 60)), addZero (t % 60)].join (':');
if (t) setTimeout (showTimeLess, 345);
}
var t = document.getElementById ('my_timer').textContent.split (':');
sessionStorage.setItem ('timeset', (t [0] * 60 + +t [1]) * 1000);
showTimeLess ();