JMeter 在beanshell中进行时间戳加减

${__Random(5,50,rd_day_start)};
${__Random(10,20,rd_day_end)};
int rd_day_start = Integer.parseInt(vars.get("rd_day_start"));
int rd_day_end = Integer.parseInt(vars.get("rd_day_end"));
//var now_date = new Date().getTime(); //获取当前时间戳
int day_before1 = rd_day_start+rd_day_end;
var start_date = new Date().getTime() - (rd_day_start+rd_day_end)* 24* 60 * 60 * 1000L;//当前时间戳 +- n 天
vars.put("start_date",start_date.toString());
var end_date = new Date().getTime() - rd_day_end * 24 * 60 * 60 * 1000L;
vars.put("end_date",end_date.toString())
posted @ 2019-12-26 11:37  鲨鱼逛大街  阅读(2164)  评论(0编辑  收藏  举报