JMeter Time Functions
JMeter Time Functions
${__time(yyyy-MM-dd-HH:mm:ss:SSS a XXX)} :Generate 2020-10-21-11:16:38:966 AM +05:30
${__timeShift(yyyy-MM-dd HH:mm:ss,,P2D,,)} :Generate a future date by adding 2 days in the current day
${__timeShift(yyyy-MM-dd HH:mm:ss,,PT2H,,)} :Generate a future time by adding 2 hours in the current time
${__timeShift(yyyy-MM-dd HH:mm:ss,,PT2M,,)} :Generate a future time by adding 2 minutes in the current time
${__timeShift(yyyy-MM-dd HH:mm:ss,,P2DT2H,,)} :Generate a future date and time by adding 2 days and 2 hours in the current timestamp
${__timeShift(yyyy-MM-dd HH:mm:ss,,-PT2M,,)} :Generate a past time by reducing 2 minutes in the current time
${__timeShift(yyyy-MM-dd HH:mm:ss,,-P2DT2H,,)} :Generate a past date and time by reducing 2 days and 2 hours in the current timestamp
${__timeShift(yyyy-MM-dd HH:mm:ss,2020-10-20,P2D,,)} :Generate 2020-10-22 which is the next 2nd day from the specified date.
Input Argument:
- Format: Refer to the below table for the input format to get the required value.
- Name of Variable: To store the generated value in a variable.
Format | Example | Description |
---|---|---|
${__time()} | 1710076012661 | Current Time in Epoch Format in milliseconds |
${__time(/1000)} | 1710076012 | Current Time in Epoch Format in seconds |
${__time(yyyy)} | 2024 | Current Year |
${__time(MM)} | 03 | Current Month in digit |
${__time(MMM)} | Mar | 3 letters of the Current Month |
${__time(MMMM)} | March | Full spell of Current Month |
${__time(LL)} | 03 | Current Month in digit |
${__time(LLL)} | Mar | 3 letters of the Current Month |
${__time(LLLL)} | March | Full 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)} | 69684021 | milliseconds |
${__time(a)} | AM or PM | Current Meridian |
${__time(n)} | 432000000 | nano-of-second |
${__time(N)} | 70283500000000 | nano-of-day |
${__time(z)} | IST | Timezone in abbreviation |
${__time(zzzz)} | India Standard Time | Timezone |
${__time(Z)} | +0530 | Timezone offset in hours (RFC pattern) |
${__time(XXX)} | +05:30 | Timezone offset in ISO format |
${__time(O)} | GMT+5:30 | Localized zone-offset |
${__time(u)} | 2024 | Current Year |
${__time(E)} / ${__time(EEEE)} | Wed / Wednesday | Current Day in letters |
${__time(e)} / ${__time(c)} | 1 | Current Day Number (1 – Sunday, 2 – Monday, 3 – Tuesday, 4 – Wednesday, 5 – Thursday, 6 – Friday, 7 – Saturday) |
${__time(ee)} / ${__time(cc)} | 01 | Current Day Number (01 – Sunday, 02 – Monday, 03 – Tuesday, 04 – Wednesday, 05 – Thursday, 06 – Friday, 07 – Saturday) |
${__time(eee)} / ${__time(ccc)} | Sun | Current Day in 3 letters format |
${__time(eeee)} / ${__time(cccc)} | Sunday | Current Day |
${__time(F)} | 3 | Week in a month (1 – First week, 2 – Second week) |
${__time(D)} | 70 | Current day count in the year |
${__time(W)} | 3 | Week in a month (1 – First week, 2 – Second week) |
${__time(w)} | 11 | Week in a year |
${__time(G)} | AD | Current Era |
${__time(Q)} | 1 | Quarter of the year in one digit |
${__time(QQ)} | 01 | Quarter of the year in two digits |
${__time(QQQ)} | Q1 | Quarter of the year in alpha-numeric format |
${__time(QQQQ)} | 1st quarter | Quarter 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.
Comments
Post a Comment