实际上我正在尝试改变时间,我正在处理的应用程序是 UTC 并且我正在使用 IST。
我已经使用了 BEAN Shell 预处理器和 shiftTime 函数
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
int AddSeconds= 00; //this variable needs to be customized as per your need
int AddMinutes= 392; //this variable needs to be customized as per your need
int AddHours= 00; //this variable needs to be customized as per your need
Date now = new Date();
Calendar c = Calendar.getInstance();
c.setTime(now);
c.add(Calendar.SECOND, AddSeconds);
c.add(Calendar.MINUTE, AddMinutes);
c.add(Calendar.HOUR, AddHours);
Date NewTime = c.getTime();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
String mytime = df.format(NewTime);
vars.put("NewTime",mytime);
班次时间:"${__timeShift(yyyy-MM-dd'T'HH:mm:ss.SSS'Z',,PT393M,,)}"
当我在 Jmeter 中运行 HTTP 请求时,时间格式仅在 12 小时内而不是 24 小时内出现而且时间转换以奇怪的方式出现,我从过去 2 天开始尝试了 Stackoverflow 的所有选项,但无法完成我的转换任务IST 到 UTC。
这就是我在 Jmeter Post body 中使用的在 此处输入图像描述
这就是我得到的结果 在此处输入图像描述
时间格式在这里完全不匹配,有人可以帮我在使用这些时间格式和函数时正确地将 IST 转换为 UTC。
