Format
  • 16 Apr 2024
  • 1 Minute to read
  • Dark
    Light

Format

  • Dark
    Light

Article summary

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 Functin Syntax

Format(<value>, <format string>, [<culture code>])

The parameters of the function are:

Name

Description
valueThe Number or Date-Time value to format.
format stringThe Format String to apply.
culture codeThe 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 Function Example

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 Function Example

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 Function Example

Format([Datasource].[MyDatasource].[Variable].[vNumericValue], "000")


Was this article helpful?