Link to home
Start Free TrialLog in
Avatar of net-workx
net-workxFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Format Variable As 2 Decimal Places - URGENT 500 Points

Hello i have this code..

                  <% Response.Write strCurrencySymbol %>
                  <% intVatAmount = ((intSubTotal/100) * strVatRate) %>
                  <% IF intVatAmount = 0 THEN Response.Write "0.00" ELSE Response.Write intVatAmount %>

and would like to know how to response.write intVatAmount as 2 decimal places (as in a currency)

Regards,
Carl
Avatar of gyra
gyra

response.write(formatCurrency(intVatAmount))
hello, sorry i didn't say hi, here's your new code:

               <% Response.Write strCurrencySymbol %>
               <% intVatAmount = ((intSubTotal/100) * strVatRate) %>
               <% IF intVatAmount = 0 THEN Response.Write "0.00" ELSE Response.Write formatCurrency(intVatAmount )%>
Avatar of net-workx

ASKER

This is not what i want to do as the format currency uses the servers local variable - i want this system to be currenty independant from the server.

the Response.Write strCurrencySymbol comes from a personalisation table which has VAT rates, currency symbols, currency types for integration into the payment processing gateway.

I just need to know how to format the figure as 13.65 rather than 13.65665454 for example.

Regards,
Carl
ASKER CERTIFIED SOLUTION
Avatar of gyra
gyra

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
the 2 in the formatNumber represents how many numbers after the decimal you want to show.
Thanks for your help - worked perfectly!!

Regards,
Carl
glad to help!