如何让日期累加

GregorianCalendar to = new GregorianCalendar();
to.setTime(toDate);
to.add(GregorianCalendar.DAY_OF_YEAR, 1);
GregorianCalendar from = new GregorianCalendar();
from.setTime(fromDate);
    while(from.before(to))
      {
          from.add(GregorianCalendar.DAY_OF_YEAR, 1);
          System.out.println("fromDate="+format.format(from.getTime()));
       }

 

你可能感兴趣的:(如何让日期累加)