第一个问题不用循环啊,代码如下。你的第二个问题没看明白~
- Calendar c1=Calendar.getInstance();
- long time1=c1.getTimeInMillis();
- Calendar c2=Calendar.getInstance();
- c2.set(2014,6,23);
- long time2=c2.getTimeInMillis();
- Long day=(time1-time2)/(24*60*60*1000);
- System.out.println(day);
复制代码 |