let's say you time an action in your app and it takes 215 seconds.
you don't want to tell the user "215", you want to show them the duration in an "hh:mm:ss" format.
the standard advice is to use a date library, but i found a much simpler and faster way:
var seconds = 215;
var strTime=new Date( seconds * 1000 ).toUTCString().split(" ");
alert(strTime); // shows "00:03:35"
it (almost) goes without saying that it only supports up to 23h59m59s max...
short, simple, works in IE6+, and has no messy loops.
BROWSER STATS [% share]
(2013/10/31) IE7:0.5, IE8:8.6, IE9:5.3, IE10:12.3, FF:17.7, CH:41.8, SF:8.1, MOBILE:20.4