Click to See Complete Forum and Search --> : Formatting number


Gopinath
07-22-2003, 08:16 AM
I have a number 7
But i want to display it like 007.00
3 points as integer and 2 points as decimal
how it is possible?

thanq

Gollum
07-22-2003, 09:28 AM
you could try something like...

var n = 7;
var str = ('00' + n.toFixed(2));
str = str.substring(str.length - 6,str.length);