core / io.islandtime / Date

Date

(iosArm64, iosX64, jvm, macosX64) class Date : Comparable<Date>

A date in an arbitrary region.

Constructors

(iosArm64, iosX64, jvm, macosX64)

<init>

Create a Date from a year, ISO month number, and day of month.

<init>(year: Int, monthNumber: Int, day: Int)

Create a Date from a year, month, and day of month.

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

Properties

(iosArm64, iosX64, jvm, macosX64)

dayOfMonth

The day of the month.

val dayOfMonth: Int
(iosArm64, iosX64, jvm, macosX64)

dayOfWeek

The day of the week.

val dayOfWeek: DayOfWeek
(iosArm64, iosX64, jvm, macosX64)

dayOfYear

The day of the year -- also known as the ordinal date in ISO-8601.

val dayOfYear: Int
(iosArm64, iosX64, jvm, macosX64)

daysSinceUnixEpoch

The number of days away from the Unix epoch (1970-01-01T00:00Z) that this date falls.

val daysSinceUnixEpoch: LongDays
(iosArm64, iosX64, jvm, macosX64)

isInLeapYear

Check if this date falls within a leap year.

val isInLeapYear: Boolean
(iosArm64, iosX64, jvm, macosX64)

isLeapDay

Check if this is a leap day.

val isLeapDay: Boolean
(iosArm64, iosX64, jvm, macosX64)

lengthOfMonth

The length of this date's month in days.

val lengthOfMonth: IntDays
(iosArm64, iosX64, jvm, macosX64)

lengthOfYear

The length of this date's year in days.

val lengthOfYear: IntDays
(iosArm64, iosX64, jvm, macosX64)

month

The month of the year.

val month: Month
(iosArm64, iosX64, jvm, macosX64)

monthNumber

The ISO month number, from 1-12.

val monthNumber: Int
(iosArm64, iosX64, jvm, macosX64)

unixEpochDay

The day of the Unix epoch.

val unixEpochDay: Long
(iosArm64, iosX64, jvm, macosX64)

year

The year.

val year: Int
(iosArm64, iosX64, jvm, macosX64)

yearMonth

The combined year and month.

val yearMonth: YearMonth

Functions

(iosArm64, iosX64, jvm, macosX64)

compareTo

fun compareTo(other: Date): Int
(iosArm64, iosX64, jvm, macosX64)

component1

operator fun component1(): Int
(iosArm64, iosX64, jvm, macosX64)

component2

operator fun component2(): Month
(iosArm64, iosX64, jvm, macosX64)

component3

operator fun component3(): Int
(iosArm64, iosX64, jvm, macosX64)

copy

Return a copy of this Date, replacing individual components with new values as desired.

fun copy(year: Int = this.year, month: Month = this.month, dayOfMonth: Int = this.day): Date
fun copy(year: Int = this.year, monthNumber: Int, dayOfMonth: Int = this.day): Date
fun copy(year: Int = this.year, dayOfYear: Int = this.dayOfYear): Date
(iosArm64, iosX64, jvm, macosX64)

equals

fun equals(other: Any?): Boolean
(iosArm64, iosX64, jvm, macosX64)

hashCode

fun hashCode(): Int
(iosArm64, iosX64, jvm, macosX64)

minus

Return a Date with period subtracted from it.

operator fun minus(period: Period): Dateoperator fun minus(years: IntYears): Date
operator fun minus(years: LongYears): Date
operator fun minus(months: IntMonths): Date
operator fun minus(months: LongMonths): Date
operator fun minus(weeks: IntWeeks): Date
operator fun minus(weeks: LongWeeks): Date
operator fun minus(days: IntDays): Date
operator fun minus(days: LongDays): Date
(iosArm64, iosX64, jvm, macosX64)

plus

Return a Date with period added to it.

operator fun plus(period: Period): Dateoperator fun plus(years: IntYears): Date
operator fun plus(years: LongYears): Date
operator fun plus(months: IntMonths): Date
operator fun plus(months: LongMonths): Date
operator fun plus(weeks: IntWeeks): Date
operator fun plus(weeks: LongWeeks): Date
operator fun plus(days: IntDays): Date
operator fun plus(days: LongDays): Date
(iosArm64, iosX64, jvm, macosX64)

rangeTo

operator fun rangeTo(other: Date): DateRange

toString

(iosArm64, iosX64, macosX64) fun toString(): <ERROR CLASS>
(jvm) fun toString(): String

Companion Object Properties

(iosArm64, iosX64, jvm, macosX64)

MAX

val MAX: Date
(iosArm64, iosX64, jvm, macosX64)

MIN

val MIN: Date

Companion Object Functions

(iosArm64, iosX64, jvm, macosX64)

fromDaysSinceUnixEpoch

Create the Date that falls a certain number of days from the Unix epoch of 1970-01-01

fun fromDaysSinceUnixEpoch(days: LongDays): Date
(iosArm64, iosX64, jvm, macosX64)

fromUnixEpochDay

Create a Date from the day of the Unix epoch

fun fromUnixEpochDay(day: Long): Date

Extension Functions

(jvm)

toJavaLocalDate

fun Date.toJavaLocalDate(): LocalDate