Java java.time Period fields, constructors, methods, implement or subclass

Example usage for Java java.time Period fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for java.time Period.

The text is from its open source code.

Field

PeriodZERO
A constant for a period of zero.

Method

TemporaladdTo(Temporal temporal)
Adds this period to the specified temporal object.
Periodbetween(LocalDate startDateInclusive, LocalDate endDateExclusive)
Obtains a Period consisting of the number of years, months, and days between two dates.
booleanequals(Object obj)
Checks if this period is equal to another period.
Periodfrom(TemporalAmount amount)
Obtains an instance of Period from a temporal amount.
longget(TemporalUnit unit)
Gets the value of the requested unit.
IsoChronologygetChronology()
Gets the chronology of this period, which is the ISO calendar system.
intgetDays()
Gets the amount of days of this period.
intgetMonths()
Gets the amount of months of this period.
ListgetUnits()
Gets the set of units supported by this period.
intgetYears()
Gets the amount of years of this period.
inthashCode()
A hash code for this period.
booleanisNegative()
Checks if any of the three units of this period are negative.
booleanisZero()
Checks if all three units of this period are zero.
Periodminus(TemporalAmount amountToSubtract)
Returns a copy of this period with the specified period subtracted.
PeriodminusDays(long daysToSubtract)
Returns a copy of this period with the specified days subtracted.
PeriodminusMonths(long monthsToSubtract)
Returns a copy of this period with the specified months subtracted.
PeriodminusYears(long yearsToSubtract)
Returns a copy of this period with the specified years subtracted.
PeriodmultipliedBy(int scalar)
Returns a new instance with each element in this period multiplied by the specified scalar.
Periodnegated()
Returns a new instance with each amount in this period negated.
Periodnormalized()
Returns a copy of this period with the years and months normalized.
Periodof(int years, int months, int days)
Obtains a Period representing a number of years, months and days.
PeriodofDays(int days)
Obtains a Period representing a number of days.
PeriodofMonths(int months)
Obtains a Period representing a number of months.
PeriodofWeeks(int weeks)
Obtains a Period representing a number of weeks.
PeriodofYears(int years)
Obtains a Period representing a number of years.
Periodparse(CharSequence text)
Obtains a Period from a text string such as PnYnMnD .
Periodplus(TemporalAmount amountToAdd)
Returns a copy of this period with the specified period added.
PeriodplusDays(long daysToAdd)
Returns a copy of this period with the specified days added.
PeriodplusMonths(long monthsToAdd)
Returns a copy of this period with the specified months added.
PeriodplusYears(long yearsToAdd)
Returns a copy of this period with the specified years added.
TemporalsubtractFrom(Temporal temporal)
Subtracts this period from the specified temporal object.
StringtoString()
Outputs this period as a String , such as P6Y3M1D .
longtoTotalMonths()
Gets the total number of months in this period.
PeriodwithDays(int days)
Returns a copy of this period with the specified amount of days.
PeriodwithMonths(int months)
Returns a copy of this period with the specified amount of months.
PeriodwithYears(int years)
Returns a copy of this period with the specified amount of years.