codes.reactive.scalatime

Period

object Period

Factory object for obtaining instances of Period.

Period is a date-based amount of time in the ISO-8601 calendar system, such as '2 years, 3 months and 4 days'.

Source
Period.scala
Example:
  1. import codes.reactive.scalatime._
    
    // Obtain a Period of 10 weeks
    val tenWeeks = Period.weeks(10)
    
    // Obtain a Period of zero
    val zero = Period.Nil
Note

Direct use of this object is not the only mechanism to obtain Period instances. See also syntax for alternatives.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Period
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

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

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Definition Classes
    AnyRef → Any
  4. val Nil: scalatime.Period

    Obtains a Period of zero.

  5. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  6. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def days(days: Int): scalatime.Period

    Obtains a Period representing a number of days.

  8. final def eq(arg0: AnyRef): Boolean

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

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

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. def fortnights(fortnights: Int): scalatime.Period

    Obtains a Period representing a number of fortnights.

  12. def from(amount: scalatime.TemporalAmount): Try[scalatime.Period]

    Tries to obtain a Period from a temporal amount by looping around the set of units from the amount and using the YEARS, MONTHS and DAYS units to create a period.

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

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

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

    Definition Classes
    Any
  16. def months(months: Int): scalatime.Period

    Obtains a Period representing a number of months.

  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 parse(text: String): Try[scalatime.Period]

    Tries to obtain a Duration from text based on the ISO-8601 Period format - PnDTnHnMn.nS - PnYnMnD and PnW.

    Tries to obtain a Duration from text based on the ISO-8601 Period format - PnDTnHnMn.nS - PnYnMnD and PnW.

    Text Format

    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.

    Example:
    1. import codes.reactive.scalatime._
      
      // Parses as 1 year, 2 months, 3 days
      val peri1 = Period.parse("P1Y2M3D")
      
      // Parses as minus 1 year, 2 months, zero days
      val peri2 = Period.parse("P-1Y2M")
  21. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  22. def toString(): String

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

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. def weeks(weeks: Int): scalatime.Period

    Obtains a Period representing a number of weeks.

  27. def years(years: Int): scalatime.Period

    Obtains a Period representing a number of years.

Inherited from AnyRef

Inherited from Any

Ungrouped