# Sound.length Formatting

**URL:** <https://forum.kirupa.com/t/sound-length-formatting/227276>\
**Category:** flash\
**Created:** [May 29, 2007, 4:29am UTC](https://forum.kirupa.com/t/sound-length-formatting/227276 "2007-05-29T04:29:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![saveth](https://avatars.discourse-cdn.com/v4/letter/s/7c8e57/32.png) [@saveth](https://forum.kirupa.com/u/saveth)\
**Post date:** [May 29, 2007, 4:29am UTC](https://forum.kirupa.com/t/sound-length-formatting/227276/1 "2007-05-29T04:29:16Z")

</div>

I’m trying to format the value returned by sound.length. Here is my code but it is calculating the value wrong. Any help would be appreciated.

375040 passed in = 6250:40  
The length of the song should be 6:15

Thanks,  
Saveth

```auto

private function formatTime(value:int):String {
    var result:String = (value % 60).toString();
    if (result.length == 1) {
     result = Math.floor(value / 60).toString() + ":0" + result;
    } else {
     result = Math.floor(value / 60).toString() + ":" + result;
    }
    return result;
   }

```
