Skip to main content

Format bindings

@DateTime I format <valueRef> from "<source-format>" to "<target-format>" as <name>

Converts the given date/time value to another format and stores the result in the given name in the global scope.

Where

    <valueRef> is the name of the binding containing the source date/time value

    • Can be the name of any binding that contains or resolves to a date/time value, including a web element in which case the text in the element will be dynamically retrieved and used.
  • <source-format> is the source date time format pattern to convert from
  • <source-format> is the target date time format pattern to convert to
  • <name> is the name to bind the formatted date/time value to

Example

  Given ISO date is "2026-03-14"
When @DateTime I format ISO date from "yyyy-MM-dd" to "dd/MM/yyyy" as dmy date
Then dmy date should be "14/03/2026"
@Number I format <valueRef> from "<source-format>" to "<target-format>" as <name>

Converts the given numeric value to another format and stores the result in the given name in the global scope.

Where

    <valueRef> is the name of the binding containing the source numeric value

    • Can be the name of any binding that contains or resolves to a numeric value, including a web element in which case the text in the element will be dynamically retrieved and used.
  • <source-format> is the source decimal number format pattern to convert from
  • <source-format> is the target decimal number format pattern to convert to
  • <name> is the name to bind the formatted numeric value to

Example

  Given number is "1234"
When @Number I format number from "#" to "$#,##0.00" as dollars
Then dollars should be "$1,234.00"