+ Start a Discussion

Format Double to Currency



We see in other post that we can format a outputtext to transform a double to a currency value. We do this



             <apex:outputPanel styleClass="dataCol" style="padding-right:15px">
                <apex:outputText value="{0,number,currency}" id="iPrecioPro" >
                    <apex:param value="{!sPrecioPro}" />



This code format our Double inCurrency but the Currency is something like this: $ 152,000.00 and we have select Europe configuration, weexpected something like 152.000,00 . It is non configurable by some param like Local or something simeless in java?


Thank you

Rajesh ShahRajesh Shah

You do not want the dollar sign? If you just want to customize the number format, you can do so. Heres an example:

<apex:outputText rendered="{!NOT(ISBLANK(item.Actual_Value__c))}" value="{0, number, #,##0.00}"> <apex:param value="{!item.Actual_Value__c}" /> </apex:outputText>

 Based on the above, my number will always have atleast 2 decimal places and atleast an unit value. And it will also generate comman after 3 every numbers. Also, if you still want the dollar sign and an customized format, you could hard code the sign before displaying the formatted number. Hope this helps.