乐趣区

关于java:获取两个时间相隔天数

两个日期之间相隔天数

 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);
退出移动版