共计 229 个字符,预计需要花费 1 分钟才能阅读完成。
两个日期之间相隔天数
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);
正文完