知乎专栏 |
对比时间
Period fromUnits = Period.of(3, 10, 10); Period fromDays = Period.ofDays(50); Period fromMonths = Period.ofMonths(5); Period fromYears = Period.ofYears(10); Period fromWeeks = Period.ofWeeks(40);
LocalDate start = LocalDate.of(2019,9,25); LocalDate end = LocalDate.of(2019,9,29); Period period = Period.between(start, end); System.out.println("相差天数="+period.getDays());