Skip to content

__time

JMeter __time function reference: syntax, parameters, and practical examples for parameterizing test plans with dynamic values.

Difficulty
intermediate
Guide type
reference
Estimated read time
1 min read
Last verified version
Verified JMeter 5.6

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.

NameRequiredDescription
FormatNoThe 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 variableNoThe 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 = yyyyMMdd
  • HMS = HHmmss
  • YMDHMS = yyyyMMdd-HHmmss
  • USER1 = whatever is in the JMeter property time.USER1
  • USER2 = whatever is in the JMeter property time.USER2

The defaults can be changed by setting the appropriate JMeter property, e.g. time.YMD=yyMMdd

Terminal window
\${__time(dd/MM/yyyy,)}

will return 21/01/2018 if ran on 21 january 2018

Terminal window
\${__time(YMD,)}

will return 20180121 if ran on 21 january 2018

Terminal window
\${__time()}

will return time in millis 1516540541624

${__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.

On this page