JMeter __time 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.
TL;DR: __time returns the current date/time, formatted however you specify (or epoch milliseconds by default) โ the standard way to stamp requests with a live timestamp for signing, cache-busting, or unique identifiers.
The time function returns the current time in various formats.
| Name | Required | Description |
|---|---|---|
| Format | No | The format to be passed to DateTimeFormatter. The function supports various shorthand aliases, see below. If omitted, the function returns the current time in milliseconds since the epoch. |
| Name of variable | No | The name of the variable to set. |
If the format string is omitted, then the function returns the current time in milliseconds since the epoch.
If the format matches โ/dddโ (where ddd are decimal digits),
then the function returns the current time in milliseconds divided by the value of ddd.
For example, โ/1000โ returns the current time in seconds since the epoch.
Otherwise, the current time is passed to DateTimeFormatter.
The following shorthand aliases are provided:
YMD=yyyyMMddHMS=HHmmssYMDHMS=yyyyMMdd-HHmmssUSER1= whatever is in the JMeter propertytime.USER1USER2= whatever is in the JMeter propertytime.USER2
The defaults can be changed by setting the appropriate JMeter property, e.g.
time.YMD=yyMMdd
\${__time(dd/MM/yyyy,)}will return 21/01/2018 if ran on 21 january 2018
\${__time(YMD,)}will return 20180121 if ran on 21 january 2018
\${__time()}will return time in millis 1516540541624
Example
Section titled โExampleโ${__time(dd/MM/yyyy,)} โ 21/01/2026${__time(/1000,)} โ epoch seconds${__time(YMD,)} โ 20260121 (shorthand alias)${__time(,epochMs)} โ epoch millis, stored in var "epochMs"Frequently paired with HMAC signing in a JSR223 PreProcessor for APIs that require a timestamp in the request signature.