Dynamic date and time values
Use dynamic date and time values for your step properties to generate them at runtime. For example, you can define the current date as an identifier for a message:
-
The base date comes from the local system time and is expressed in ISO 8601 format.
-
Define date and time values using one of the step properties: Insert, Verify, or Trigger.
Use current date and time values
The dynamic expressions DATE and TIME create values based on the actual date and time. For example, use these expressions to create timestamps for tracking purposes.
The examples in the table use January 13, 2022, and 2:18 PM (14:18:00) as base values:
|
Expression |
Description |
Example |
|---|---|---|
|
{DATE} |
Full date |
2022-01-13 |
|
{TIME} |
Current date and time |
2022-01-13T14:18:00 |
Calculate dates from a base date
You can calculate dynamic date and time values by defining a base date along with offsets using the syntax {<EXPRESSION>[<Base date>][<Offset>][<Format>]}.
|
Parameter |
Description |
|---|---|
|
Base date |
Specify a date value. If you leave the value empty, API simulation uses the current date as the base date. You can also use buffer values as the base date. |
|
Offset |
Define what to add or subtract from the base date. Offsets consist of a signed integer and a unit. These are the possible values:
|
|
Format |
Define the date format if the date format of the test object differs from the ISO 8601 format. The default value is yyyy-MM-dd. |
To apply the standard behavior to one of the parameters, leave the parameter value empty []. For instance, {DATE} and {DATE[][][]} have the same meaning. API simulation uses the current date without deviations.
With the expression +3M-1d, you add three months to the base date and subtract one day.
The expression {DATE[2022-05-23][+3M-1d][]} returns 2022-08-22.
In the following examples, you use the value of a buffer as the base date:
-
If the buffer date is 2022-11-10, the expression {DATE[{B[Variable]}][+1M+1d][]} returns 2022-12-11.
-
If the buffer date is 2022-12-20, the expression {DATE[{B[Variable]}][-1M][01.MM.yyyy]} returns 01.11.2022.
-
If the buffer date is 2022-12-24T12:34:56Z, the expression {TIME[{B[Variable]}][+2d+1h][]} returns 2022-12-26T13:34:56Z.