// this code is in the publicdomain
function PadDigits(n, totalDigits) {
n = n.toString();
var pd = "";
if (totalDigits > n.length) {
for (i = 0; i < (totalDigits - n.length); i++) {
pd += "0";
}
}
return pd + n.toString();
}
Back to Directory