# Mp3 time display

**URL:** <https://forum.kirupa.com/t/mp3-time-display/205879>\
**Category:** flash\
**Created:** [November 2, 2006, 9:09pm UTC](https://forum.kirupa.com/t/mp3-time-display/205879 "2006-11-02T21:09:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![modelreject](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@modelreject](https://forum.kirupa.com/u/modelreject)\
**Post date:** [November 2, 2006, 9:09pm UTC](https://forum.kirupa.com/t/mp3-time-display/205879/1 "2006-11-02T21:09:56Z")

</div>

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
