SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
Date date1 = null;
Date date2 = null;
long l = 0l;
String k = "";
ArrayList dlist = new ArrayList();
try {
date1 = new SimpleDateFormat("yyyyMMdd").parse("20100929");
date2 = new SimpleDateFormat("yyyyMMdd").parse("20101002");
l = 1 + (date2.getTime() - date1.getTime())/ (24 * 60 * 60 * 1000l);
for (int i = 0; i < l; i++) {
k = Integer.parseInt("20100929") + i + "";
if ((df.format(df.parse(k))).equals(k)) {
dlist.add(k);
} else {
dlist.add(df.format(df.parse(k)));
}
}
} catch (ParseException e) {
e.printStackTrace();
}
时间相减
最新推荐文章于 2021-05-27 07:20:34 发布