org.threeten.bp

Period

object Period extends Serializable

Annotations
@SerialVersionUID( 8290556941213247973L )
Linear Supertypes
Serializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Period
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. val ZERO: Period

    A constant for a period of zero.

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def between(startDate: LocalDate, endDate: LocalDate): Period

    Obtains a Period consisting of the number of years, months, and days between two dates.

    Obtains a Period consisting of the number of years, months, and days between two dates.

    The start date is included, but the end date is not. The period is calculated by removing complete months, then calculating the remaining number of days, adjusting to ensure that both have the same sign. The number of months is then split into years and months based on a 12 month year. A month is considered if the end day-of-month is greater than or equal to the start day-of-month. For example, from 2010-01-15 to 2011-03-18 is one year, two months and three days.

    The result of this method can be a negative period if the end is before the start. The negative sign will be the same in each of year, month and day.

    startDate

    the start date, inclusive, not null

    endDate

    the end date, exclusive, not null

    returns

    the period between this date and the end date, not null

    See also

    ChronoLocalDate#until(ChronoLocalDate)

  9. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. def from(amount: TemporalAmount): Period

    Obtains an instance of Period from a temporal amount.

    Obtains an instance of Period from a temporal amount.

    This obtains a period based on the specified amount. A TemporalAmount represents an amount of time, which may be date-based or time-based, which this factory extracts to a Period.

    The conversion loops around the set of units from the amount and uses the ChronoUnit#YEARS YEARS, ChronoUnit#MONTHS MONTHS and ChronoUnit#DAYS DAYS units to create a period. If any other units are found then an exception is thrown.

    If the amount is a ChronoPeriod then it must use the ISO chronology.

    amount

    the temporal amount to convert, not null

    returns

    the equivalent period, not null

    Exceptions thrown
    ArithmeticException

    if the amount of years, months or days exceeds an int

    DateTimeException

    if unable to convert to a { @code Period}

  14. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  15. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  20. def of(years: Int, months: Int, days: Int): Period

    Obtains a Period representing a number of years, months and days.

    Obtains a Period representing a number of years, months and days.

    This creates an instance based on years, months and days.

    years

    the amount of years, may be negative

    months

    the amount of months, may be negative

    days

    the amount of days, may be negative

    returns

    the period of years, months and days, not null

  21. def ofDays(days: Int): Period

    Obtains a Period representing a number of days.

    Obtains a Period representing a number of days.

    The resulting period will have the specified days. The years and months units will be zero.

    days

    the number of days, positive or negative

    returns

    the period of days, not null

  22. def ofMonths(months: Int): Period

    Obtains a Period representing a number of months.

    Obtains a Period representing a number of months.

    The resulting period will have the specified months. The years and days units will be zero.

    months

    the number of months, positive or negative

    returns

    the period of months, not null

  23. def ofWeeks(weeks: Int): Period

    Obtains a Period representing a number of weeks.

    Obtains a Period representing a number of weeks.

    The resulting period will have days equal to the weeks multiplied by seven. The years and months units will be zero.

    weeks

    the number of weeks, positive or negative

    returns

    the period of days, not null

  24. def ofYears(years: Int): Period

    Obtains a Period representing a number of years.

    Obtains a Period representing a number of years.

    The resulting period will have the specified years. The months and days units will be zero.

    years

    the number of years, positive or negative

    returns

    the period of years, not null

  25. def parse(text: CharSequence): Period

    Obtains a Period from a text string such as PnYnMnD.

    Obtains a Period from a text string such as PnYnMnD.

    This will parse the string produced by toString() which is based on the ISO-8601 period formats PnYnMnD and PnW.

    The string starts with an optional sign, denoted by the ASCII negative or positive symbol. If negative, the whole period is negated. The ASCII letter "P" is next in upper or lower case. There are then four sections, each consisting of a number and a suffix. At least one of the four sections must be present. The sections have suffixes in ASCII of "Y", "M", "W" and "D" for years, months, weeks and days, accepted in upper or lower case. The suffixes must occur in order. The number part of each section must consist of ASCII digits. The number may be prefixed by the ASCII negative or positive symbol. The number must parse to an int.

    The leading plus/minus sign, and negative values for other units are not part of the ISO-8601 standard. In addition, ISO-8601 does not permit mixing between the PnYnMnD and PnW formats. Any week-based input is multiplied by 7 and treated as a number of days.

    For example, the following are valid inputs:

    "P2Y"             -- Period.ofYears(2)
    "P3M"             -- Period.ofMonths(3)
    "P4W"             -- Period.ofWeeks(4)
    "P5D"             -- Period.ofDays(5)
    "P1Y2M3D"         -- Period.of(1, 2, 3)
    "P1Y2M3W4D"       -- Period.of(1, 2, 25)
    "P-1Y2M"          -- Period.of(-1, 2, 0)
    "-P1Y2M"          -- Period.of(-1, -2, 0)
    

    text

    the text to parse, not null

    returns

    the parsed period, not null

    Exceptions thrown
    DateTimeParseException

    if the text cannot be parsed to a period

  26. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  27. def toString(): String

    Definition Classes
    AnyRef → Any
  28. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped