Java Date and Time: How do I make plus() and until() to be each others inverse
问题 Most of the time, these 2 methods are each others inverse: Temporal Temporal.plus(long, TemporalUnit) long Temporal.until(Temporal, TemporalUnit) For example starting from 1-JAN: System.out.println("1-JAN plus 1 month: " + LocalDate.of(2017, 1, 1).plus(1, ChronoUnit.MONTHS)); System.out.println("1-JAN until 1-FEB in months: " + LocalDate.of(2017, 1, 1).until(LocalDate.of(2017, 2, 1), ChronoUnit.MONTHS)); They are each others inverse: 1-JAN plus 1 month: 2017-02-01 1-JAN until 1-FEB in months: