Skip to content

//core/io.islandtime.measures/Years

Years

common

@JvmInline

value class Years(val value: Long) : Comparable<Years>

Constructors

Years

common

constructor(value: Int)

constructor(value: Long)

Types

Name Summary
Companion

common


object Companion

Properties

Name Summary
absoluteValue

common


val absoluteValue: Years

The absolute value of this duration.
inMonths

common


val inMonths: Months

Converts this duration to months.
inWholeCenturies

common


val inWholeCenturies: Centuries

Converts this duration to the number of whole centuries.
inWholeDecades

common


val inWholeDecades: Decades

Converts this duration to the number of whole decades.
value

common


val value: Long

The underlying value.

Functions

Name Summary
asPeriod

common


fun Years.asPeriod(): Period

Converts this duration into a Period with the same number of years.
compareTo

common


open operator override fun compareTo(other: Years): Int
div

common


operator fun div(scalar: Int): Years

operator fun div(scalar: Long): Years

Returns this duration divided by a scalar value.
minus

common


operator fun minus(centuries: Centuries): Years

operator fun minus(decades: Decades): Years

operator fun minus(months: Months): Months

operator fun minus(years: Years): Years
minus

common


operator fun Years.minus(period: Period): Period
plus

common


operator fun plus(centuries: Centuries): Years

operator fun plus(decades: Decades): Years

operator fun plus(months: Months): Months

operator fun plus(years: Years): Years
plus

common


operator fun Years.plus(period: Period): Period
rem

common


operator fun rem(scalar: Int): Years

operator fun rem(scalar: Long): Years

Returns the remainder of this duration divided by a scalar value.
times

common


operator fun times(scalar: Int): Years

operator fun times(scalar: Long): Years

Multiplies this duration by a scalar value.
toComponents

common


inline fun <T> toComponents(action: (decades: Decades, years: Years) -> T): T

inline fun <T> toComponents(action: (centuries: Centuries, decades: Decades, years: Years) -> T): T
toComponentValues

common


inline fun <T> toComponentValues(action: (decades: Long, years: Int) -> T): T

inline fun <T> toComponentValues(action: (centuries: Long, decades: Int, years: Int) -> T): T
toDouble

common


fun toDouble(): Double

Converts this duration to a Double value.
toInt

common


fun toInt(): Int

Converts this duration to an Int value.
toJavaPeriod

jvm


fun Years.toJavaPeriod(): Period

Converts this duration to an equivalent Java Period.
toLong

common


fun toLong(): Long

Converts this duration to a Long value.
toString

common


open override fun toString(): String

Converts this duration to an ISO-8601 time interval representation.
unaryMinus

common


operator fun unaryMinus(): Years

Negates this duration.