object Period extends Serializable
- Annotations
- @SerialVersionUID()
- Alphabetic
- By Inheritance
- Period
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
lazy val
ZERO: Period
A constant for a period of zero.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
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
to2011-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)
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
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 aPeriod
.The conversion loops around the set of units from the amount and uses the
YEARS
,MONTHS
andDAYS
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 intDateTimeException
if unable to convert to a { @code Period}
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
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
-
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
-
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
-
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
-
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
-
def
parse(text: CharSequence): Period
Obtains a
Period
from a text string such asPnYnMnD
.Obtains a
Period
from a text string such asPnYnMnD
.This will parse the string produced by
toString()
which is based on the ISO-8601 period formatsPnYnMnD
andPnW
.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
andPnW
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
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()