Two decimal

Whing Dela Cruz
Whing Dela Cruz used Ask the Experts™
on
Hi experts, I wish to convert 1 to write into 1.00 Please see the code below

<%
i = 48 //I wish to write this into 48.00
j = 48.5 //I wish to write this into 48.50
%>
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Web Ninja at large
Commented:
try using the FormatNumber() function:

<%
i = FormatNumber( 48, 2 )
j = FormatNumber( 48.5 )
%>
HainKurtSr. System Analyst

Commented:
try

<%=FormatNumber(n,2)%>

Open in new window

HainKurtSr. System Analyst
Commented:
your code is just assigning...

assign whatever you want, but when you need to write, use FormatNumber(n,d) where d is a number for decimal count...

Author

Commented:
Thanks both of you guys, its working!
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
Where does the JavaScript come in - are you wanting to output this from ASP or in JavaScript?

If ASP take a look at FormatNumber

If JavaScript take a look at toFixed()

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial