0%
两个日期相隔的所有日期
使用Scala实现
1 2 3 4 5 6 7
| def getDateList(cDate: String, endDate: String) = { val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd") val date1 = LocalDate.parse(cDate, formatter) val date2 = LocalDate.parse(endDate, formatter) val duration = ChronoUnit.DAYS.between(date1, date2) List.range(0, duration).map(date1.plusDays(_).toString) }
|