added a note about formatter usage

fixes #9435
This commit is contained in:
Carsten Brandt
2015-08-16 16:21:57 +02:00
parent 620ec4d132
commit 96a92bc2e0

View File

@ -40,6 +40,12 @@ echo Yii::$app->formatter->format('2014-01-01', 'date');
echo Yii::$app->formatter->format(0.125, ['percent', 2]);
```
> Note: The formatter component is designed to format values to be displayed for the end user. If you want
> to convert user input into machine readable format, or just format a date in a machine readable format,
> the formatter is not the right tool for that.
> To convert user input for date and number values you may use [[yii\validators\DateValidator]] and [[yii\validators\NumberValidator]]
> respectively. For simple conversion between machine readable date and time formats,
> the PHP [date()](http://php.net/manual/en/function.date.php)-function is enough.
## Configuring Formatter <span id="configuring-formatter"></span>