Decimal Separator and Number of Decimal Digits

Hi, I’m trying to deal with decimal numbers in Yii, but I have some problems:

I need to display 123,45 instead of 123.45

I’ve tried the following in my Yii I18n file:

‘decimalFormat’ => ‘#.##0,##’, //two digits after comma

‘scientificFormat’ => ‘#E0’,

‘percentFormat’ => ‘#,##0%’,

‘currencyFormat’ => ‘¤#.##0,00;(¤#.##0,00)’,

but when I call

$numberFormatter->formatDecimal($model->myDecimalValue), Yii returns 1,690 instead of 1,69

Another thing:

Sometimes I need to show ,00 two digits after comma and sometimes three digits ,000 after comma, how do I do this?

Thanks in advance

:>))

I was having problems with this, too. I am using this way:

Formats:




 'numberSymbols' => 

  array (

    'decimal' => ',',

    'group' => '.',

    ....

  ),

'decimalFormat' => '#,##0.##',

'scientificFormat' => '#E0',

'percentFormat' => '#,##0%',

'currencyFormat' => '¤#,##0.00;(¤#,##0.00)',



Now, you can make $numberFormatter->formatDecimal($model->myDecimalValue) works in the right form.

Yes, it works like a charm!!

Thanks, Rick

:>))