java 定义三分钟之前的时间
public String getCurrentTime(){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar beforeTime = Calendar.getInstance();
beforeTime.add(Calendar.MINUTE, -3);// 3分钟之前的时间
Date beforeD = beforeTime.getTime();
String time = sdf.format(beforeD);
return time;
}
技术改变一切