Formatcurrency With No Decimals

Shouldn’t FormatCurrency be truncating decimals for locales that do not use decimals? For example, if I’m doing a price conversion from Dollars to Yen, Yen doesn’t have decimals.

As a test:

	setlocale(LC_ALL, 'ja.UTF-8');


	$strReturn = Yii::app()->numberFormatter->formatCurrency('500.00','JPY');


PHPUnit_Framework_ExpectationFailedException : Failed asserting that two strings are equal.

Expected :¥500

Actual :¥500.00

Sorry, I don’t know much about Yen formatting, but maybe you can influence the output by format parameters?


Did you got some solution for this? I have the same problem, I don’t want decimals and I get an error if I try to use ‘formatNumber’: Call to protected method CNumberFormatter::formatNumber() from context 'CBaseController.

Now I have this:

Yii::app()->numberFormatter->formatCurrency($data->total_amount, 'EUR')

I got this: €500.00, and I want this: €500

So I tried with format like this:

Yii::app()->numberFormatter->format('#,##0', $data->total_amount, 'EUR')

but then I don’t get the currency symbol, any suggestion?


Yii::app()->numberFormatter->format('##,### ¤', $data->total_amount, 'EUR');