how to format decimal into Indian currency format? i.e. 1234567.89 to 12,34,567.89

Is there any function we can use to convert a decimal into Indian currency format? I have tried formatDecimal() . With formatDecimal() I am able to convert into American format only (1234567.89 to 1,234,567.89) but what I want to achieve is to convert 1234567.89 to 12,34,567.89. In other words, while moving towards left from decimal point, after 3 digit I need to put a comma and then after every two digit a comma.
2 answers

Hi Prathemesh,


You can format the decimal like below:


formatDecimal(1234567.89,'##,##,###.##') – This will give you result in string.


After that use parseDecimal to convert string to decimal.


Have a look at the Decimal Tools module in the marketplace. It provides a more fully featured version of the built-in formatDecimal function that can convert a decimal to a string that isn’t dependant on the current locale.