This filter is for formatting decimal numbers.
- The first parameter of number_format determines how many numbers the decimal part contains. In the following example, it is 2, so 2 decimals will be displayed from the 3.
- The second parameter defines the decimal separator, which is , (comma) in this case. The third parameter stands for the thousands separator, which is . (period) here.
{{ 9800.333|number_format(2, ',', '.') }}
Result
9.800,33
Please note that if no parameter is given for the number_format filter, the decimals are not displayed at all and the thousands separator is , (comma).
{{ 2005.35|number_format }}
Result
2,005