1.添加BeanShell PreProcessor
2.编辑脚本
import java.text.SimpleDateFormat;
import java.util.Date;
Date date = new Date();
Date date1 = new Date();
date.setDate(date.getDate()+2);
SimpleDateFormat df = new SimpleDateFormat("YYYY-MM-dd");
// or: SimpleDateFormat df = new SimpleDateFormat("MM-dd-yyyy");
String formattedDate = df.format(date);
String formattedDate1 = df.format(date1);
vars.put("Co",formattedDate);
vars.put("Ci",formattedDate1);
时间: 2024-11-05 19:41:48