JMeter __timeShift function reference: syntax, parameters, and practical examples for parameterizing test plans with dynamic values.
Also documented in context in the full Functions and Variables reference.
The timeShift function returns a date in the given format with the specified amount of seconds, minutes, hours, days or months added
| Name | Required | Description |
|---|---|---|
| Format | No | The format to be passed to DateTimeFormatter (for input data parsing and output formating). See DateTimeFormatter If omitted, the function uses milliseconds since epoch format. |
| Date to shift | No | Indicate the date in the format set by the parameter Format to shift. If omitted, the date is set to ZonedDateTime.now with system zone ZoneId.systemDefault(). :::note If Format is empty then this parameter must be long value (look at examples). ::: |
| value to shift | No | Indicate the specified amount of seconds, minutes, hours or days to shift according to a textual representation of a duration such as PnDTnHnMn.nS. See Duration#parse(CharSequence). If ommitted, no shifting will be done. - PT20.345S parses as 20.345 seconds - PT15M parses as 15 minutes - PT10H parses as 10 hours - P2D parses as 2 days - -P6H3M parses as -6 hours and -3 minutes |
| Locale to use for format | No | The string format of a locale. The language code must be lowercase. The country code must be uppercase. The separator must be an underscore (_). For example en_EN See supported locales on Java 7. If omitted, by default the function uses the current locale from the JVM. |
| Name of variable | No | The name of the variable to set. |
Examples:
\${__timeShift(dd/MM/yyyy,21/01/2018,P2D,,)}returns 23/01/2018
\${__timeShift(dd MMMM yyyy,21 fรฉvrier 2018,P2D,fr_FR,)}returns 23 fรฉvrier 2018
\${__timeShift(,10000,PT10S,,)}returns 20000 = 10sec input + 10sec shift
\${__timeShift(,,PT10S,,)}returns 1632158276770 = 1632158266770 ms (now) + 10sec shift