- 13 Dec 2023
- 1 Minute to read
- DarkLight
Format
- Updated on 13 Dec 2023
- 1 Minute to read
- DarkLight
General
The format function takes a Number or Date-Time value and converts it to a String applying the supplied Format String.
Syntax
You can call the Format function using the following syntax:
Format(<value>, <format string>, [<culture code>])
The parameters of the function are:
Name | Description |
---|---|
value | The Number or Date-Time value to format. |
format string | The Format String to apply. |
culture code | The code of the culture to use when formatting. If you don't specify this optional parameter, the currently applicable culture will be used; this is either the default culture (which can be configured in the Server Settings or a culture that has been activated using an Activate Culture action.). This needs to be one of the values of the CultureInfo Code column of the Culture Code List. |
Examples
The following expression returns a String that contains the formatted number 1234 using a Format String that adds group and decimal separators and enforces two decimals and at least one digit before the decimal separator:
Format(1234, "#,##0.00")
The following expression returns a String that contains the formatted number 1234 using a Format String that adds group and decimal separators and enforces two decimals and at least one digit before the decimal separator using the US-american decimal and group separators:
Format(1234, "#,##0.00", "en-US")
The following expression formats the numeric value of the variable vNumericValue of the Datasource named MyDatasource by using a Datasource Variable Value Placeholder and a Format String that enforces three digits, no decimals, and no group separator:
Format([Datasource].[MyDatasource].[Variable].[vNumericValue], "000")