core / io.islandtime / YearMonth

YearMonth

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86) class YearMonth : Comparable<YearMonth>

A month in a particular year.

Constructors

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

<init>

Creates a YearMonth.

<init>(year: Int, monthNumber: Int)
<init>(year: Int, month: Month)

Properties

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

dateRange

The range of dates within this year-month.

val dateRange: DateRange
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

dayRange

The range of days within this year-month.

val dayRange: IntRange
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

endDate

The Date representing the last day in this year-month.

val endDate: Date
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

firstDayOfYear

The ordinal date corresponding to the first day of this year-month.

val firstDayOfYear: Int
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

isInLeapYear

Checks if this year-month falls within a leap year.

val isInLeapYear: Boolean
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

lastDay

The last day of the year-month.

val lastDay: Int
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

lastDayOfYear

The ordinal date corresponding to the last day of this year-month.

val lastDayOfYear: Int
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

lengthOfMonth

The length of the year-month in days.

val lengthOfMonth: IntDays
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

lengthOfYear

The length of the year in days.

val lengthOfYear: IntDays
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

month

The month of the year.

val month: Month
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

monthNumber

The ISO month number, from 1-12.

val monthNumber: Int
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

startDate

The Date representing the first day in this year-month.

val startDate: Date
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

year

The year.

val year: Int

Functions

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

compareTo

fun compareTo(other: YearMonth): Int
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

contains

operator fun contains(date: Date): Boolean
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

copy

Returns a copy of this year-month with the values of any individual components replaced by the new values specified.

fun copy(year: Int = this.year, month: Month = this.month): YearMonth
fun copy(year: Int = this.year, monthNumber: Int): YearMonth
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

equals

fun equals(other: Any?): Boolean
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

hashCode

fun hashCode(): Int
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

minus

operator fun minus(years: IntYears): YearMonth
operator fun minus(years: LongYears): YearMonth
operator fun minus(months: IntMonths): YearMonth
operator fun minus(months: LongMonths): YearMonth
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

plus

operator fun plus(years: IntYears): YearMonth
operator fun plus(years: LongYears): YearMonth
operator fun plus(months: IntMonths): YearMonth
operator fun plus(months: LongMonths): YearMonth
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

toString

Converts this date-time to a string in ISO-8601 extended format. For example, 2012-04.

fun toString(): String

Companion Object Properties

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

MAX

The latest supported YearMonth, which may be used to indicate the "far future".

val MAX: YearMonth
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

MIN

The earliest supported YearMonth, which may be used to indicate the "far past".

val MIN: YearMonth

Extension Functions

(jvm)

toJavaYearMonth

Convert to an equivalent Java YearMonth.

fun YearMonth.toJavaYearMonth(): YearMonth