jmeter中使用beansehell生成随机时间,并加N天
程序员文章站
2022-06-10 21:27:32
...
import java.time.LocalDate; import java.time.format.DateTimeFormatter; int max=30,min=1; int ran2 = (int) (Math.random()*(max-min)+min); LocalDate date_diy=LocalDate.of(2020, 11, ran2); String ymddiy = date_diy.format(DateTimeFormatter.ofPattern("yyyy-MM-dd 00:00:00")); String ymddiy_add7 = date_diy.plusDays(7).format(DateTimeFormatter.ofPattern("yyyy-MM-dd 00:00:00")); vars.put("start", ymddiy); vars.put("end", ymddiy_add7);