/**
* 获取两个日期之间的所有日期
* @param startTime 开始日期
* @param endTime 结束日期
* @return
*/
@PermitAll
@GetMapping("timeQuJian")
public AjaxResult timeQuJian(String startTime,String endTime ) throws ParseException {
//日期集合
List
startTime = "2021-06-07";
endTime = "2021-06-12";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date start = simpleDateFormat.parse(startTime);
Date end = simpleDateFormat.parse(endTime);
Calendar timeStart = Calendar.getInstance();
timeStart.setTime(start);
Calendar timeEnd = Calendar.getInstance();
timeEnd.setTime(end);
timeEnd.add(Calendar.DATE,+1);// 日期加1(包含结束)
while (timeStart.before(timeEnd))
{
days.add(simpleDateFormat.format(timeStart.getTime()));
timeStart.add(Calendar.DAY_OF_YEAR,1);
}
return AjaxResult.success(days);
}