def today = getNowDate()
//-1days
def yesterday = ?
给你copy的 apache组织的代码
public static Date add(Date date, int calendarField, int amount) {
if (date == null) {
throw new IllegalArgumentException("The date must not be null");
}
Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(Calendar.DAY_OF_MONTH, amount);
return c.getTime();
}
如何调用
def yesterday = addDays(new Date(),-1)