Using the DollarFormat Function

Use the DollarFormat( ) function to format values with a dollar sign, a thousand separator, and 2 decimal places. Its syntax is:

DollarFormat(NumericValue)

DollarFormat function usage examples

The two code sets below display $23,333.44 in a browser:

<CFOUTPUT>
    #DollarFormat(2333344)#
</CFOUTPUT>

The code below formats the Salary column data that was returned from a query performed earlier on the same page:

<CFOUTPUT QUERY="EmpList">
    #DollarFormat(Salary)#<BR>
</CFOUTPUT>
Note To format currency for display:
  1. Return to the page that you're building.
  2. Format the Salary query data using the DollarFormat() function within the existing TD block:
  3. #DollarFormat(Salary)#
    
  4. Save the file.
  5. View the page in a browser.
  6. The Salary is formatted for page display.

Click here to see how the page should look at this time.

Click here to see the code behind the scenes.

Note Note:The navigation links will not work at this time.