Search code examples
javascriptxmljmeterunix-timestampxls

How to extract TimeStamp in correct format from XML in XLS Report


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>

Solution

  • I want to share the solution to the solved problem. I changed the XSL version to 2.0. Below is the code solution to converting Unix epoch time of jmeter to human readable.

    <td><xsl:value-of select='xs:dateTime("1970-01-01T00:00:00") + @ts * xs:dayTimeDuration("PT0.001S")'/></td>