views:

122

answers:

1

I'm using the Last.fm API and I stuck on something seemingly fairly simple.

One of the responses is the duration. Which is returned as:

222000

But how do I format (in PHP) this to look like

MIN:SEC
3:42
+3  A: 

It looks like the duration is in milliseconds. Just divide by 1000 to get the number of seconds.

maxpower47
In addition: echo date('i:s', $duration / 1000);
Philippe Gerber
Wonderful. Thanks max and philippe :)
Ben Shelock