For the following Period
calculation:
Period.between(LocalDate.of(2015, 8, 1), LocalDate.of(2015, 9, 2))
the result is:
P1M1D
This is equivalent to 31 days + 1 day = 32 days.
For this Period
:
Period.between(LocalDate.of(2015, 8, 1), LocalDate.of(2015, 10, 2))
the result is:
P2M1D
This is equivalent to: 31 days (in August) + 30 days (in September) + 1 (in October) = 62 days
Is there a method in the java.time
package which will give the number of days in a Period
? I can't find one. Not sure if I have overlooked anything or if it is just plain not there.
long get(TemporalUnit unit)
, TemporalUnit can be ChronoUnit.DAYS – Novick