首页 > 代码库 > JAVA Calendar 日期加减

JAVA Calendar 日期加减

Date starttime=new Date();
Calendar cal = Calendar.getInstance();
cal.setTime(starttime);
cal.set(Calendar.DATE, cal.get(Calendar.DATE) - 2);
starttime= cal.getTime();