YearMonth

A month in a particular year.

class YearMonth(year: Int,month: Month) : Comparable<YearMonth>

Parameters

month

the month of the year

year

the year

Constructors

YearMonth
Link copied to clipboard
common

Creates a YearMonth.

fun YearMonth(year: Int, monthNumber: Int)
YearMonth
Link copied to clipboard
common

Creates a YearMonth.

fun YearMonth(year: Int, month: Month)

Types

Companion
Link copied to clipboard
common
object Companion

Functions

compareTo
Link copied to clipboard
common
open operator override fun compareTo(other: YearMonth): Int
contains
Link copied to clipboard
common
operator fun contains(date: Date): Boolean
copy
Link copied to clipboard
common

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

fun copy(year: Int, month: Month): YearMonth
fun copy(year: Int, monthNumber: Int): YearMonth
equals
Link copied to clipboard
common
open operator override fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
common
open override fun hashCode(): Int
minus
Link copied to clipboard
common
operator fun minus(years: IntYears): YearMonth
operator fun minus(years: LongYears): YearMonth
operator fun minus(months: IntMonths): YearMonth
operator fun minus(months: LongMonths): YearMonth
plus
Link copied to clipboard
common
operator fun plus(years: IntYears): YearMonth
operator fun plus(years: LongYears): YearMonth
operator fun plus(months: IntMonths): YearMonth
operator fun plus(months: LongMonths): YearMonth
toString
Link copied to clipboard
common

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

open override fun toString(): String

Properties

dateRange
Link copied to clipboard
common

The range of dates within this year-month.

val dateRange: DateRange
dayRange
Link copied to clipboard
common

The range of days within this year-month.

val dayRange: IntRange
endDate
Link copied to clipboard
common

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

val endDate: Date
firstDayOfYear
Link copied to clipboard
common

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

val firstDayOfYear: Int
isInLeapYear
Link copied to clipboard
common

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

val isInLeapYear: Boolean
lastDay
Link copied to clipboard
common

The last day of the year-month.

val lastDay: Int
lastDayOfYear
Link copied to clipboard
common

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

val lastDayOfYear: Int
lengthOfMonth
Link copied to clipboard
common

The length of the year-month in days.

val lengthOfMonth: IntDays
lengthOfYear
Link copied to clipboard
common

The length of the year in days.

val lengthOfYear: IntDays
month
Link copied to clipboard
common

The month of the year.

val month: Month
monthNumber
Link copied to clipboard
common

The ISO month number, from 1-12.

val monthNumber: Int
startDate
Link copied to clipboard
common

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

val startDate: Date
year
Link copied to clipboard
common

The year.

val year: Int

Extensions

atDay
Link copied to clipboard
common

Combines a YearMonth with a day of the month to create a Date.

fun YearMonth.atDay(day: Int): Date
toJavaYearMonth
Link copied to clipboard

Converts this year-month to an equivalent Java YearMonth.

fun YearMonth.toJavaYearMonth(): YearMonth
toNSDateComponents
Link copied to clipboard
darwin

Converts this year-month to an equivalent NSDateComponents object.

fun YearMonth.toNSDateComponents(includeCalendar: Boolean): <ERROR CLASS>
toYear
Link copied to clipboard
common

Returns this year-month with the precision reduced to the year.

fun YearMonth.toYear(): Year