jmeter bean shell 时间戳

import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

Calendar c = Calendar.getInstance();//获取当前时间
        
        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");

          c.add(Calendar.DATE, -0);
          String silent_newday = sdf1.format(c.getTime())+" 00:00:00";
          
          c.add(Calendar.DATE, -60);//获取过去60天的
          String silent_oldday = sdf1.format(c.getTime())+" 00:00:00";
          
          
          vars.put("silent_oldday",silent_oldday);
          vars.put("silent_newday",silent_newday);

 

posted @ 2021-01-21 11:13  GAOLANG  阅读(430)  评论(0编辑  收藏  举报