Jmeter如何打印时间戳

2025-05-15 23:34:04

1、Jmeter中提供了一种函数,可以打印时间戳,如下图

Jmeter如何打印时间戳

3、执行,查看结果树,可以看到结果中,将当前时间打印出来了哦~

Jmeter如何打印时间戳Jmeter如何打印时间戳

6、附:beanshell打印时间的代码import java.text.SimpleDateFormat;import java.util.Calendar;import java.util.Date;try{Date date =new Date(); //获取当前时间SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");String nowDate = sf.format(date);Calendar cal = Calendar.getInstance();cal.setTime(sf.parse(nowDate));cal.add(Calendar.DAY_OF_YEAR,+0);String orderDate = sf.format(cal.getTime());cal.add(Calendar.DAY_OF_YEAR,+365);String senderDate = sf.format(cal.getTime());vars.put("orderDate",orderDate);vars.put("senderDate",senderDate);}catch(Exception e){}

Jmeter如何打印时间戳
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢