Uses of Class
java.time.Period

Packages that usePeriod
Package
Description
java.time
The main API for dates, times, instants, and durations.
java.time.chrono
Generic API for calendar systems other than the default ISO.
java.time.format
Provides classes to print and parse dates and times.
  • Uses ofPeriod injava.time

    Fields injava.time declared asPeriod
    Modifier and Type
    Field
    Description
    static finalPeriod
    Period.ZERO
    A constant for a period of zero.
    Methods injava.time that returnPeriod
    Modifier and Type
    Method
    Description
    staticPeriod
    Period.between(LocalDate startDateInclusive,LocalDate endDateExclusive)
    Obtains aPeriod consisting of the number of years, months, and days between two dates.
    staticPeriod
    Period.from(TemporalAmount amount)
    Obtains an instance ofPeriod from a temporal amount.
    Period.minus(TemporalAmount amountToSubtract)
    Returns a copy of this period with the specified period subtracted.
    Period.minusDays(long daysToSubtract)
    Returns a copy of this period with the specified days subtracted.
    Period.minusMonths(long monthsToSubtract)
    Returns a copy of this period with the specified months subtracted.
    Period.minusYears(long yearsToSubtract)
    Returns a copy of this period with the specified years subtracted.
    Period.multipliedBy(int scalar)
    Returns a new instance with each element in this period multiplied by the specified scalar.
    Period.negated()
    Returns a new instance with each amount in this period negated.
    Period.normalized()
    Returns a copy of this period with the years and months normalized.
    staticPeriod
    Period.of(int years, int months, int days)
    Obtains aPeriod representing a number of years, months and days.
    staticPeriod
    Period.ofDays(int days)
    Obtains aPeriod representing a number of days.
    staticPeriod
    Period.ofMonths(int months)
    Obtains aPeriod representing a number of months.
    staticPeriod
    Period.ofWeeks(int weeks)
    Obtains aPeriod representing a number of weeks.
    staticPeriod
    Period.ofYears(int years)
    Obtains aPeriod representing a number of years.
    staticPeriod
    Period.parse(CharSequence text)
    Obtains aPeriod from a text string such asPnYnMnD.
    Period.plus(TemporalAmount amountToAdd)
    Returns a copy of this period with the specified period added.
    Period.plusDays(long daysToAdd)
    Returns a copy of this period with the specified days added.
    Period.plusMonths(long monthsToAdd)
    Returns a copy of this period with the specified months added.
    Period.plusYears(long yearsToAdd)
    Returns a copy of this period with the specified years added.
    LocalDate.until(ChronoLocalDate endDateExclusive)
    Calculates the period between this date and another date as aPeriod.
    Period.withDays(int days)
    Returns a copy of this period with the specified amount of days.
    Period.withMonths(int months)
    Returns a copy of this period with the specified amount of months.
    Period.withYears(int years)
    Returns a copy of this period with the specified amount of years.
    Methods injava.time with parameters of typePeriod
    Modifier and Type
    Method
    Description
    LocalDate.datesUntil(LocalDate endExclusive,Period step)
    Returns a sequential ordered stream of dates by given incremental step.
  • Uses ofPeriod injava.time.chrono

    Methods injava.time.chrono that returnPeriod
    Modifier and Type
    Method
    Description
    IsoChronology.period(int years, int months, int days)
    Obtains a period for this chronology based on years, months and days.
  • Uses ofPeriod injava.time.format

    Methods injava.time.format that return types with arguments of typePeriod
    Modifier and Type
    Method
    Description
    static finalTemporalQuery<Period>
    DateTimeFormatter.parsedExcessDays()
    A query that provides access to the excess days that were parsed.