An immutable period consisting of the ISO-8601 years, months, days, hours, minutes, seconds and milliseconds, such as '3 Months, 4 Days and 7 Hours'.
A period is a human-scale description of an amount of time.
no subtypes hierarchy
Initializer |
Period(Integer years = 0, Integer months = 0, Integer days = 0, Integer hours = 0, Integer minutes = 0, Integer seconds = 0, Integer milliseconds = 0) Parameters:
|
Attributes | |
dateOnly | Source Codeshared actual ReadableDatePeriod dateOnly Returns a date only view of this period. Refines ReadablePeriod.dateOnly |
days | Source Codeshared actual Integer days The number of days. Refines ReadableDatePeriod.days |
hash | Source Codeshared actual Integer hash This implementation respect the constraint that if |
hours | Source Codeshared actual Integer hours The number of hours. Refines ReadableTimePeriod.hours |
milliseconds | Source Codeshared actual Integer milliseconds The number of milliseconds. Refines ReadableTimePeriod.milliseconds |
minutes | Source Codeshared actual Integer minutes The number of minutes. Refines ReadableTimePeriod.minutes |
months | Source Codeshared actual Integer months The number of months. Refines ReadableDatePeriod.months |
seconds | Source Codeshared actual Integer seconds The number of seconds. Refines ReadableTimePeriod.seconds |
string | Source Codeshared actual String string Returns the ISO-8601 formatted string for this period. Refines Object.string |
timeOnly | Source Codeshared actual ReadableTimePeriod timeOnly Returns a time only view of this period. Refines ReadablePeriod.timeOnly |
years | Source Codeshared actual Integer years The number of years. Refines ReadableDatePeriod.years |
Inherited Attributes |
Attributes inherited from: ReadableDatePeriod |
Attributes inherited from: ReadablePeriod |
Attributes inherited from: ReadableTimePeriod |
Methods | |
compare | Source Codeshared actual Comparison compare(Period other) Return the result of comparing this period to the other period. Refines Comparable.compare |
equals | Source Codeshared actual Boolean equals(Object that) Checks if this period is equal to another period. |
isZero | Source Codeshared Boolean isZero() Checks if this period is zero-length. |
minusDays | Source Codeshared actual Period minusDays(Integer days) Returns a copy of this period with the specified number of days subtracted. Refines PeriodBehavior.minusDays |
minusHours | Source Codeshared actual Period minusHours(Integer hours) Returns a copy of this period with the specified number of hours subtracted. Refines PeriodBehavior.minusHours |
minusMilliseconds | Source Codeshared actual Period minusMilliseconds(Integer milliseconds) Returns a copy of this period with the specified number of milliseconds subtracted. Refines PeriodBehavior.minusMilliseconds |
minusMinutes | Source Codeshared actual Period minusMinutes(Integer minutes) Returns a copy of this period with the specified number of minutes subtracted. Refines PeriodBehavior.minusMinutes |
minusMonths | Source Codeshared actual Period minusMonths(Integer months) Returns a copy of this period with the specified number of months subtracted. Refines PeriodBehavior.minusMonths |
minusSeconds | Source Codeshared actual Period minusSeconds(Integer seconds) Returns a copy of this period with the specified number of seconds subtracted. Refines PeriodBehavior.minusSeconds |
minusYears | Source Codeshared actual Period minusYears(Integer years) Returns a copy of this period with the specified number of years subtracted. Refines PeriodBehavior.minusYears |
normalized | Source Codeshared actual Period normalized() Returns a copy of this period with all amounts normalized to the standard ranges for date/time fields. Two normalizations occur, one for years and months, and one for hours, minutes, seconds and milliseconds. Days are not normalized, as a day may vary in length at daylight savings cutover. Neither is days normalized into months, as number of days per month varies from month to another and depending on the leap year. Refines PeriodBehavior.normalized |
plus | Source Codeshared actual Period plus(Period other) Returns a new period that is a sum of the two periods. Refines Summable.plus |
plusDays | Source Codeshared actual Period plusDays(Integer days) Returns a copy of this period with the specified number of days added. Refines PeriodBehavior.plusDays |
plusHours | Source Codeshared actual Period plusHours(Integer hours) Returns a copy of this period with the specified number of hours added. Refines PeriodBehavior.plusHours |
plusMilliseconds | Source Codeshared actual Period plusMilliseconds(Integer milliseconds) Returns a copy of this period with the specified number of milliseconds added. Refines PeriodBehavior.plusMilliseconds |
plusMinutes | Source Codeshared actual Period plusMinutes(Integer minutes) Returns a copy of this period with the specified number of minutes added. Refines PeriodBehavior.plusMinutes |
plusMonths | Source Codeshared actual Period plusMonths(Integer months) Returns a copy of this period with the specified number of months added. Refines PeriodBehavior.plusMonths |
plusSeconds | Source Codeshared actual Period plusSeconds(Integer seconds) Returns a copy of this period with the specified number of seconds added. Refines PeriodBehavior.plusSeconds |
plusYears | Source Codeshared actual Period plusYears(Integer years) Returns a copy of this period with the specified number of years added. Refines PeriodBehavior.plusYears |
scale | Source Codeshared actual Period scale(Integer scale) Each field will be scalable independently, and the result will not be normalized Refines Scalable.scale |
withDays | Source Codeshared actual Period withDays(Integer days) Returns a copy of this period with the specified amount of days. Refines PeriodBehavior.withDays |
withHours | Source Codeshared actual Period withHours(Integer hours) Returns a copy of this period with the specified amount of hours. Refines PeriodBehavior.withHours |
withMilliseconds | Source Codeshared actual Period withMilliseconds(Integer milliseconds) Returns a copy of this period with the specified amount of milliseconds. Refines PeriodBehavior.withMilliseconds |
withMinutes | Source Codeshared actual Period withMinutes(Integer minutes) Returns a copy of this period with the specified amount of minutes. Refines PeriodBehavior.withMinutes |
withMonths | Source Codeshared actual Period withMonths(Integer months) Returns a copy of this period with the specified amount of months. Refines PeriodBehavior.withMonths |
withSeconds | Source Codeshared actual Period withSeconds(Integer seconds) Returns a copy of this period with the specified amount of seconds. Refines PeriodBehavior.withSeconds |
withYears | Source Codeshared actual Period withYears(Integer years) Returns a copy of this period with the specified amount of years. Refines PeriodBehavior.withYears |
Inherited Methods |
Methods inherited from: Comparable<Other> |
Methods inherited from: PeriodBehavior<Self> PeriodBehavior.minusDays() , PeriodBehavior.minusHours() , PeriodBehavior.minusMilliseconds() , PeriodBehavior.minusMinutes() , PeriodBehavior.minusMonths() , PeriodBehavior.minusSeconds() , PeriodBehavior.minusYears() , PeriodBehavior.normalized() , PeriodBehavior.plusDays() , PeriodBehavior.plusHours() , PeriodBehavior.plusMilliseconds() , PeriodBehavior.plusMinutes() , PeriodBehavior.plusMonths() , PeriodBehavior.plusSeconds() , PeriodBehavior.plusYears() , PeriodBehavior.withDays() , PeriodBehavior.withHours() , PeriodBehavior.withMilliseconds() , PeriodBehavior.withMinutes() , PeriodBehavior.withMonths() , PeriodBehavior.withSeconds() , PeriodBehavior.withYears() |
Methods inherited from: Scalable<Scale,Value> |
Methods inherited from: Summable<Other> |