+ Start a Discussion
NekosanNekosan 

Rounding decimal

Which function I can use to get following result?
If price is 5.457333333
it should show 5.46
I used setscale function .It does not show correct rounding .
Anoop yadavAnoop yadav
Hi,
Try the below code on developer console.
Decimal d = 5.457333333;
d=d.setscale(2);
System.debug('TEST:'+d);

 
Jigar.LakhaniJigar.Lakhani
Hello,

For Visualforce Page
<apex:outputText value=”{0, number,###,###,##0.00}”>
    <apex:param value=”{!mynumber}” />
</apex:outputText>

Thanks and Cheers,
Jigar