Skip to content

//core/io.islandtime.measures/Months

Months

common

@JvmInline

value class Months(value: Long) : Comparable<Months>

Constructors

Months

common

fun Months(value: Int)

Types

Name Summary
Companion

common


object Companion

Functions

Name Summary
compareTo

common


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

common


operator fun div(scalar: Int): Months

operator fun div(scalar: Long): Months

Returns this duration divided by a scalar value. @throws ArithmeticException if overflow occurs or the scalar is zero
minus

common


operator fun minus(centuries: Centuries): Months

operator fun minus(decades: Decades): Months

operator fun minus(months: Months): Months

operator fun minus(years: Years): Months
plus

common


operator fun plus(centuries: Centuries): Months

operator fun plus(decades: Decades): Months

operator fun plus(months: Months): Months

operator fun plus(years: Years): Months
rem

common


operator fun rem(scalar: Int): Months

operator fun rem(scalar: Long): Months

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

common


operator fun times(scalar: Int): Months

operator fun times(scalar: Long): Months

Multiplies this duration by a scalar value. @throws ArithmeticException if overflow occurs
toComponents

common


inline fun <T> toComponents(action: (years: Years, months: Months) -> T): T

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

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

common


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

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

inline fun <T> toComponentValues(action: (centuries: Long, decades: Int, years: Int, months: 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. @throws ArithmeticException if overflow occurs
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(): Months

Negates this duration. @throws ArithmeticException if overflow occurs

Properties

Name Summary
absoluteValue

common

val absoluteValue: Months

The absolute value of this duration. @throws ArithmeticException if overflow occurs
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.
inWholeYears

common

val inWholeYears: Years

Converts this duration to the number of whole years.
value

common

val value: Long

The underlying value.

Extensions

Name Summary
asPeriod

common


fun Months.asPeriod(): Period

Converts this duration into a Period with the same number of months.
minus

common


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

common


operator fun Months.plus(period: Period): Period
toJavaPeriod

jvm


fun Months.toJavaPeriod(): Period

Converts this duration to an equivalent Java Period.