Mp3 time display

I am having trouble updating the time of a loaded mp3. The code below works if it’s just “secs” and “mins”. ie 73:23 (73 minutes 23 seconds) but with the addition of hours it shows 01:73:23 instead of 01:17:23.

Can anyone help?Pleeeeaaaaase.

formatTime = function (millisecs) {
var secs = Math.floor(millisecs/1000);
var mins = Math.floor(secs/60);
var hrs = Math.floor(mins/60);
secs %= 60;
if (secs<10) {
secs = “0”+secs;
}
if (mins<10) {
mins = “0”+mins;
}
if (hrs<10) {
hrs = “0”+hrs;
}

return hrs+":"+mins+":"+secs;

};

Thx for looking
Cb