i am having problem with extracting Timestamp from XML report, generated by JMeter using JS and i am using its values in XLS report.
i have tried multiple ways to extract Timestamp values in seconds only but it shows values as be year–month==day–hh–min–sec (epoch system) i just need to extract total time taken by the sampler to execute in seconds here is my sampler
<sample t="7" it="0" lt="0" ct="0" ts="1706503149549" s="true" lb=" Enterprise Dashboard - https://dr-wv.wmi360.com/Login/ACO/Dashboard" rc="200" rm="OK" tn="Smoke Thread Group 1-1" dt="text" by="1396210" sby="0" ng="1" na="1">
<java.net.URL>https://dr-wv.wmi360.com/Login/ACO/Dashboard</java.net.URL>
</sample>
2
Answers
i want to share the solution the problem solved as i changed the XSL version to 2.0 and below is the code solution of conversion Unix epoch time of jmeter to human readable
Timestamp is the moment in time when Sampler was started in milliseconds since Unix epoch. If you want to parse this value in JavaScript you can just create a new Date object from it:
If you’re looking for the response time (or elapsed time) – it’s
t
attribute value and in your case it’s 7 milliseconds. If you want to convert milliseconds to seconds – just divide it by 1000.In general according to JMeter Best Practices you should use CSV output, not XML one, maybe it worth considering switching, in this case JMeter will produce its results file in CSV mode which can be imported to MS Excel or equivalent without any extra effort.
The relevant JMeter property which controls the behaviour is
jmeter.save.saveservice.output_format
, set it tocsv
and re-run your test. More information on JMeter Properties concept and ways of setting and overriding them: Apache JMeter Properties Customization Guide