abrabr
abrabr

Reputation: 217

convert numberformat (coldfusion)

HI folks! i got a simple question for coldfusion users, does anyone know how to convert a dynamic number into decimals, for example i have a code: #number# and it equals to, for example 10 but i need to write it as 0.10 how do i do it? tried this: 0.#number# didnt work :)

Upvotes: 2

Views: 2221

Answers (1)

Stephen Moretti
Stephen Moretti

Reputation: 2438

So are you saying that your values in the variable "number" will have 2 decimal places at the end and that you need to display those decimal places?

If so :

<cfset actualNumber = incomingNumber/10>
<cfoutput>#NumberFormat(actualNumber,".00")#</cfoutput>

should do what you need.

Upvotes: 3

Related Questions