Format Transform
Format Transform
Watch the videoThe Format Transform applies a format string to the value returned from the binding, allowing you to format the way the output is displayed. Typically this applies to a date or number format.
Select Format Type:
- Datetime: A date will be formatted to appear a certain way.
- Numeric: A number will be formatted to appear a certain way.
Format (Numeric only)
- Pattern: Applies a number pattern (using 0 and #) and converts the results to string (good for putting in leading 0's on a display).
- Integer: Rounds input (float) to integer.
- Number: Formats number based on Language setting (puts in comma or other number separator).
- Percent: Converts the input number into percent (0.123 would format to 12.3%).
- Currency: Uses the currency specified by the Language setting.
Format (Datetime only)
- Pattern: Custom date format string (for example - M/D/YYYY hⓂ️s a).
- Date: Date only will be shown.
- Time: Time only will be shown.
- Datetime: Date and Time will be shown.
Date (Datetime only)
- Full: Example format - Monday, March 18, 2019.
- Long: Example format - March 18, 2019.
- Medium: Example format - Mar 18, 2019.
- Short: Example format - 3/18/19.
Time (Datetime only)
- Full: Example Format - 2:02:46 PM Pacific Standard Time.
- Long: Example format - 2:02:46 PM PST.
- Medium: Example format - 2:02:46 PM.
- Short: Example format - 2:02 PM.
Locale
- auto: Default time zone of Client.
- ...(Language Selection):
Time Zone (Datetime only)
- auto: Default time zone of Client.
- ...(Language Selection):
See the Data Type Formatting Reference page for more information.
Examples
Numeric Pattern
In the image below, an expression on a Tag binding is retrieving the value from a Tag. As shown in the preview, the value on the Tag shows 45.970097.
The Format transform is taking that Tag value, then applying a numeric pattern of #.00, which denotes that two digits must always be shown after the decimal point. As a result, the preview shows a Format value of 45.97, since any digits beyond the first two decimal places are ignored by the transform.
Datetime Short, Short, Time Zone Adjusted
The image below is taking a Unix timestamp value (including milliseconds) of 1551823366022, and turning it into a human readable date (set to Japan's time zone) of 3/6/19, 7:02 AM.