两个日期之间相隔天数

 public int daysBetweenDates(String date1, String date2) {
         LocalDate startDate = LocalDate.parse(date1);
        LocalDate endDate = LocalDate.parse(date2);

        long daysDiff = ChronoUnit.DAYS.between(startDate, endDate);
        return Math.abs((int)daysDiff);

阆风
34 声望3 粉丝

简单点就好。