Search code examples
jmeterjmeter-pluginsjmeter-5.0

Extract Sample start value from Sampler result tab in JMeter


I need to extract "Sample start" value means date & time value from the Sampler result tab in JMeter.

Sample Start:2022-07-13 21:56:18 IST
Load time:1549
Connect Time:292

Is there any way to do that? Please suggest some solution.


Solution

  • You can add a JSR223 PostProcessor as a child of the request which start time you want to "extract" and put the following code into "Script" area:

    vars.put('start', new Date(prev.getStartTime()).format('yyyy-MM-dd HH:mm:ss zzz'))
    

    it will store the parent Sampler start time into ${start} JMeter Variable

    Demo:

    enter image description here

    More information on what do these prev and vars things mean: Top 8 JMeter Java Classes You Should Be Using with Groovy