0

We have to Export and Download the PDF file from the application. The File name contains Filename, Date and Time(UTC).

1.Faculty report generated on 2019-01-17 13:28:01 PM by Test,User1.zip

so we are trying to capture the time but we are getting in IST zone. Could any one help us to get UTC Time ZONE on JMETER.

Kavinkumar Muthu
  • 99
  • 1
  • 5
  • 14
  • `13:28:01 PM`, is that redundant or what? I’m more used to either `13:28:01` alone or `01:28:01 PM`. – Ole V.V. Jan 18 '19 at 09:13

1 Answers1

1

Solution 1: Change your machine time to UTC , in that case JMeter automatically prints UTC time

Soluction 2: You can use Beanshell/ JSR223 sampler to change IST to UTC

The following code snippet can be used to convert time to different time zones

import java.text.SimpleDateFormat;

SimpleDateFormat dateFormatGmt = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss");
dateFormatGmt.setTimeZone(TimeZone.getTimeZone("CST"));
SimpleDateFormat dateFormatLocal = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss");
log.info("*******"+dateFormatLocal.parse( dateFormatGmt.format(new Date()) ));

enter image description here

For more info on beanshell please follow this link

Rohit
  • 601
  • 4
  • 12
  • 2
    Please don’t teach the young ones to use the long outdated and notoriously troublesome `SimpleDateFormat` class. At least not as the first option. And not without any reservation. Today we have so much better in [`java.time`, the modern Java date and time API](https://docs.oracle.com/javase/tutorial/datetime/) and its `DateTimeFormatter`. – Ole V.V. Jan 18 '19 at 08:44