
September 19th, 2006, 06:29 PM
|
|
|
Quote: | Originally Posted by marnixR 70 modulo 60, which in javascript is written as |
To take a step further you could try this (i have not fully tested this):
javascript Code:
Original
- javascript Code |
|
|
|
String.prototype.pad = function(l, s){ return (l -= this.length) > 0 ? (s = new Array(Math.ceil(l / s.length) + 1).join(s)).substr(0, s.length) + this + s.substr(0, l - s.length) : this; }; var seconds = 121; document.write( Math.floor(seconds / 60) + ":" + (seconds % 60).toFixed().pad(2, "0") );
|