Apache JMeter – time Function

time is an in-build function of Apache JMeter and its type is ‘Information’, which returns the current date and time in various formats like epoch or human-readable time etc. By the way, JMeter in-build functions are divided into eight categories which are:

  1. Information
  2. Input
  3. Calculation
  4. Formatting
  5. Scripting
  6. Properties
  7. Variables
  8. Strings
Apache JMeter - time Function

Syntax: ${__time}

Type: Information

Purpose: To generate the current date and time in the required format.

Example: If someone wants to get the date in 10/03/2024 format then he can use ${__time(dd/MM/yyyy,)}.

Input Argument:

  1. Format: Refer to the below table for the input format to get the required value.
  2. Name of Variable: To store the generated value in a variable.
FormatExampleDescription
${__time()}1710076012661Current Time in Epoch Format in milliseconds
${__time(/1000)}1710076012Current Time in Epoch Format in seconds
${__time(yyyy)}2024Current Year
${__time(MM)}03Current Month in digit
${__time(MMM)}Mar3 letters of the Current Month
${__time(MMMM)}MarchFull spell of Current Month
${__time(LL)}03Current Month in digit
${__time(LLL)}Mar3 letters of the Current Month
${__time(LLLL)}MarchFull spell of Current Month
${__time(d)} / ${__time(dd)}1 / 01
or
21 / 21
Current Day in one or two digits
${__time(h)} / ${__time(hh)}1 / 01
or
11 / 23
Current Hour in one or two digits in 12-hour format (1-12)
${__time(H)} / ${__time(HH)}1 / 01
or
11 / 23
Current Hour in one or two digits in 24-hour format (0-23)
${__time(k)} / ${__time(kk)}1 / 01
or
11 / 23
Current Hour in one or two digits in 24-hour format (1-24)
${__time(K)} / ${__time(KK)}1 / 01
or
11 / 23
Current Hour in one or two digits in 12-hour format (0-11)
${__time(m)} / ${__time(mm)}5 / 05
or
15 / 15
Current Minute in one or two digits
${__time(s)} / ${__time(ss)}2 / 02
or
19 / 19
Current Second in one or two digits
${__time(S)} / ${__time(SS)} /
${__time(SSS)}
3 / 03 / 003
or
13 / 13 / 013
or
310 / 310 / 310
Current Millisecond in one, two or three digits
${__time(A)}69684021milliseconds
${__time(a)}AM or PMCurrent Meridian
${__time(n)}432000000nano-of-second
${__time(N)}70283500000000nano-of-day
${__time(z)}ISTTimezone in abbreviation
${__time(zzzz)}India Standard TimeTimezone
${__time(Z)}+0530Timezone offset in hours (RFC pattern)
${__time(XXX)}+05:30Timezone offset in ISO format
${__time(O)}GMT+5:30Localized zone-offset
${__time(u)}2024Current Year
${__time(E)} / ${__time(EEEE)}Wed / WednesdayCurrent Day in letters
${__time(e)} / ${__time(c)}1Current Day Number (1 – Sunday, 2 – Monday, 3 – Tuesday, 4 – Wednesday, 5 – Thursday, 6 – Friday, 7 – Saturday)
${__time(ee)} / ${__time(cc)}01Current Day Number (01 – Sunday, 02 – Monday, 03 – Tuesday, 04 – Wednesday, 05 – Thursday, 06 – Friday, 07 – Saturday)
${__time(eee)} / ${__time(ccc)}SunCurrent Day in 3 letters format
${__time(eeee)} / ${__time(cccc)}SundayCurrent Day
${__time(F)}3Week in a month (1 – First week, 2 – Second week)
${__time(D)}70Current day count in the year
${__time(W)}3Week in a month (1 – First week, 2 – Second week)
${__time(w)}11Week in a year
${__time(G)}ADCurrent Era
${__time(Q)}1Quarter of the year in one digit
${__time(QQ)}01Quarter of the year in two digits
${__time(QQQ)}Q1Quarter of the year in alpha-numeric format
${__time(QQQQ)}1st quarterQuarter of the year in alpha-ordinal format

Return Value: the function returns the number, text and symbol which are used for the format. If a variable name is provided as an argument then the return value is stored in that variable.

Example: If you use ${__time(yy-MM-dd-HH:mm:ss:SSS, cTime)} to capture the current timestamp then variable cTime will store the generated value and you can use ${cTime} wherever you want to pass the generated value.

Use: The time function has a specific use to generate the date, time and related date-time values in various formats. Although it is also used to generate the unique value with epoch format.

Related Functions:


You may be interested:


Leave a Comment