ITeye博客

如何让日期累加

duyunfengsolo · 2009-09-23 19:00 · JAVA · Markdown

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()));
       }

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。