SimpleDateFormat format=new SimpleDateFormat("yyyyMMdd"); Calendar start = Calendar.getInstance(); Calendar end = Calendar.getInstance(); try { start.setTime(format.parse(str)); end.setTime(format.parse(str1)); } catch (java.text.ParseException e) { e.printStackTrace(); while(start.before(end)) System.out.println(format.format(start.getTime())); start.add(Calendar.DAY_OF_MONTH,1); }

结果:
20170805
20170806
20170807
20170808
20170809
20170810