Javascript Number toTimeCode()
Number.prototype.toTimeCode = function(){ var minutes = Math.floor(this/60); var seconds = this%60; if(minutes != NaN){ if(minutes !=0){ return minutes + ":" + seconds; }//from www . j av a 2 s . co m else{ return seconds; } } else{ return NaN; } };