User Guide Cancel

DecimalFormat

 

Description

Converts a number to a decimal-formatted string.

Returns

number as a string formatted with two decimal places and a thousands separator.

Category

Display and formatting functions

Function syntax

DecimalFormat(number)
DecimalFormat(number)
DecimalFormat(number)

See also

DollarFormatNumberFormat

Parameters

Parameter

Description

number

Number to format

Example

<h3>DecimalFormat Function</h3>
<p>Returns a number to two decimal places.
<p>
<cfloop FROM = 1 TO = 20 INDEX = "counter">
<cfoutput>
#counter# * Square Root of 2:
#DecimalFormat(counter * sqr(2))#
</cfoutput>
<br>
</cfloop>
<h3>DecimalFormat Function</h3> <p>Returns a number to two decimal places. <p> <cfloop FROM = 1 TO = 20 INDEX = "counter"> <cfoutput> #counter# * Square Root of 2: #DecimalFormat(counter * sqr(2))# </cfoutput> <br> </cfloop>
<h3>DecimalFormat Function</h3> 
<p>Returns a number to two decimal places. 
<p> 
<cfloop FROM = 1 TO = 20 INDEX = "counter"> 
<cfoutput> 
#counter# * Square Root of 2: 
#DecimalFormat(counter * sqr(2))# 
</cfoutput> 
<br> 
</cfloop>

Get help faster and easier

New user?