Audio Files

To do this one, we need to create three numbers:

We also need to make sure each number is exactly two digits - e.g. 30 or 03. That way, we always get the 00:00:00 format, which will allow us to sort by duration.

So first, we need to get those counts. We won’t worry about the digit counts just yet.

Next, we need to account for any hour/minute/second counts that are between 0-9. For these, we need to prepend a 0 – otherwise we’d get stuff like 01:9:34. This should read 01:09:34 instead.

So after creating our number variables, we’ll create an array. Each will conditionally prepend a zero if the variable is <= 9.

Finally, we’ll call join(":") on the returned array.