This class models a quantity or amount of time in terms of years, months and days. See {@link Duration} for the time-based equivalent to this class.
Durations and periods differ in their treatment of daylight savings time when added to {@link ZonedDateTime}. A {@code Duration} will add an exactnumber of seconds, thus a duration of one day is always exactly 24 hours. By contrast, a {@code Period} will add a conceptual day, trying to maintainthe local time.
For example, consider adding a period of one day and a duration of one day to 18:00 on the evening before a daylight savings gap. The {@code Period} will addthe conceptual day and result in a {@code ZonedDateTime} at 18:00 the following day.By contrast, the {@code Duration} will add exactly 24 hours, resulting in a{@code ZonedDateTime} at 19:00 the following day (assuming a one hour DST gap).
The supported units of a period are {@link ChronoUnit#YEARS YEARS}, {@link ChronoUnit#MONTHS MONTHS} and {@link ChronoUnit#DAYS DAYS}. All three fields are always present, but may be set to zero.
The ISO-8601 calendar system is the modern civil calendar system used today in most of the world. It is equivalent to the proleptic Gregorian calendar system, in which today's rules for leap years are applied for all time.
The period is modeled as a directed amount of time, meaning that individual parts of the period may be negative.
This is a value-based class; use of identity-sensitive operations (including reference equality ( {@code ==}), identity hash code, or synchronization) on instances of {@code Period} may have unpredictable results and should be avoided.The {@code equals} method should be used for comparisons. @implSpec This class is immutable and thread-safe. @since 1.8
|
|
|
|
|
|
|
|