devxlogo

Display Currency Information Correctly

Display Currency Information Correctly

Question:

I am writing an online order form in ASP. How can I restrict the value of vartax to a two decimal digit (round up to two decimal points)? Most of the time vartax displays more than a 10 decimal digit. Here is a portion of my ASP code:

'----- Following  ------<%	if Request.Form("tax3")= "on" then	vartax=vartotal*0.06125	else	vartax=0	end if%><%Response.Write "$" & vartax%>

Answer:

Use the FormatCurrency function to return a value neatly formatted as a currency.

Response.write FormatCurrency(vartax)

The look and appearance of the currency value will be obtained from your computer’s Regional Settings Currency tab.

See also  Why ChatGPT Is So Important Today
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist