Reputation: 5396
I want to get GMT +7 time into jmeter. I tried following but it seems not GMT.
${__time(dd/MM/yyyy,)}
${__time(hh:mm a,)}
${__time(dd-mmm-yyyy HHmmss)}
${__javaScript(new Date().getTime();)}
Upvotes: 1
Views: 4948
Reputation: 2303
POST data:
{"Local Date":"${__time(yyyy-MM-dd)}",
"local Time":"${__time(HH:mm:ss)}",
"UTC Date":"${__groovy(new Date().format("yyyy-MM-dd"\, TimeZone.getTimeZone('UTC')))}",
"UTC time": "${__groovy(new Date().format("HH:mm:ss"\, TimeZone.getTimeZone('UTC')))}"
}
Generates this request from Denver, Colorado, USA:
{"Local Date":"2025-02-23",
"local Time":"16:36:07",
"UTC Date":"2025-02-23",
"UTC time": "23:36:07"
}
Upvotes: 0
Reputation: 168147
As per SimpleDateFormat class documentation
So you can modify pattern of JMeter's __time() function according to your requirement. Examples:
See How to Use JMeter Functions post for more detailed information on __time() and other JMeter Functions.
Upvotes: 2