public List<String> addJob(String startDate, String endDate) throws ParseException {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = new GregorianCalendar();
calendar.setTime(dateFormat.parse(startDate));
List<String> dates = new ArrayList<>();
while (calendar.getTime().compareTo(dateFormat.parse(endDate)) <= 0) {
dates.add(dateFormat.format(calendar.getTime()));
calendar.add(Calendar.DATE, 1);
}
return dates;
}
转载于:https://my.oschina.net/u/3677751/blog/1925938