Package: java.time

## [Java] Class Period

- java.time.Period

-     public class Period
      extends Object

  GDK enhancements for Period.

  displayName:
    Period
  receiverFqcn:
    java.time.Period

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public static Period` | `between(Period type, Year startInclusive, Year endExclusive)` Obtains a Period consisting of the number of years between two Year instances.
    `` | `public static Period` | `between(Period type, YearMonth startInclusive, YearMonth endExclusive)` Obtains a Period consisting of the number of years and months between two YearMonth instances.
    `` | `public Period` | `minus(long days)` Returns a Period that is `days` days shorter than this period.
    `` | `public Period` | `multiply(int scalar)` Supports the multiply operator; equivalent to calling the Period.multipliedBy method.
    `` | `public Period` | `negative()` Supports the unary minus operator; equivalent to calling the Period.negated method.
    `` | `public Period` | `next()` Returns a Period that is one day longer than this period.
    `` | `public Period` | `plus(long days)` Returns a Period that is `days` days longer than this period.
    `` | `public Period` | `positive()` Supports the unary plus operator; returns a Period with all unit values positive.
    `` | `public Period` | `previous()` Returns a Period that is one day shorter than this period.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `addShutdownHook, any, any, asBoolean, asType, clamp, clamp, collect, collect, collect, dump, each, eachMatch, eachMatch, eachWithIndex, every, every, find, find, findAll, findAll, findIndexOf, findIndexOf, findIndexValues, findIndexValues, findLastIndexOf, findLastIndexOf, findResult, findResult, findResult, findResult, getAt, getMetaClass, getMetaPropertyValues, getProperties, grep, grep, hasProperty, identity, inject, inject, inspect, invokeMethod, is, isCase, isNotCase, iterator, metaClass, print, print, printf, printf, println, println, println, putAt, respondsTo, respondsTo, setMetaClass, sleep, sleep, split, sprintf, sprintf, stream, takeIf, tap, toString, use, use, use, with, with, withCloseable, withCloseable, withMethodClosure, withStream, withStream, withTraits`

- - ### Method Detail

    - #### public static Period between(Period type, Year startInclusive, Year endExclusive)

      Obtains a Period consisting of the number of years between two Year instances. The months and days of the Period will be zero. The result of this method can be a negative period if the end is before the start.

      Parameters:
        `type` - placeholder variable used by Groovy categories; ignored for default static methods
        `startInclusive` - the start Year, inclusive, not null
        `endExclusive` - the end Year, exclusive, not null
      Returns:
        a Period between the years
      See Also:
        Period.between

    - #### public static Period between(Period type, YearMonth startInclusive, YearMonth endExclusive)

      Obtains a Period consisting of the number of years and months between two YearMonth instances. The days of the Period will be zero. The result of this method can be a negative period if the end is before the start.

      Parameters:
        `type` - placeholder variable used by Groovy categories; ignored for default static methods
        `startInclusive` - the start YearMonth, inclusive, not null
        `endExclusive` - the end YearMonth, exclusive, not null
      Returns:
        a Period between the year/months
      See Also:
        Period.between

    - #### public Period minus(long days)

      Returns a Period that is `days` days shorter than this period. No normalization is performed.

      Parameters:
        `days` - the number of days to decrease this Period by
      Returns:
        a Period
      Since:
        2.5.0

    - #### public Period multiply(int scalar)

      Supports the multiply operator; equivalent to calling the Period.multipliedBy method.

      Parameters:
        `scalar` - a scalar to multiply each unit by
      Returns:
        a Period
      Since:
        2.5.0

    - #### public Period negative()

      Supports the unary minus operator; equivalent to calling the Period.negated method.

      Returns:
        a negated Period
      Since:
        2.5.0

    - #### public Period next()

      Returns a Period that is one day longer than this period. No normalization is performed.

      Returns:
        a Period one-day longer in length
      Since:
        2.5.0

    - #### public Period plus(long days)

      Returns a Period that is `days` days longer than this period. No normalization is performed.

      Parameters:
        `days` - the number of days to increase this Period by
      Returns:
        a Period
      Since:
        2.5.0

    - #### public Period positive()

      Supports the unary plus operator; returns a Period with all unit values positive. For example, a period of "2 years, -3 months, and -4 days" would result in a period of "2 years, 3 months, and 4 days." No normalization is performed.

      Returns:
        a positive Period
      Since:
        2.5.0

    - #### public Period previous()

      Returns a Period that is one day shorter than this period. No normalization is performed.

      Returns:
        a Period one-day shorter in length
      Since:
        2.5.0