Date

value class Date(val encoded: Int) : Comparable<Date> , Serializable

Represents a triple of year, month and day.

It is packed in a value class wrapping an Int to prevent allocations.

Constructors

Link copied to clipboard
constructor(encoded: Int)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

A DateTime instance representing this date and time from the beginning of the day.

Link copied to clipboard
val day: Int

The day part.

Link copied to clipboard
Link copied to clipboard

The dayOfWeek part as Int.

Link copied to clipboard

The dayOfYear part.

Link copied to clipboard
Link copied to clipboard

The month part.

Link copied to clipboard
val month1: Int

The month part as Int where Month.January is 1.

Link copied to clipboard
val year: Int

The year part as Int.

Link copied to clipboard

The year part as Year.

Functions

Link copied to clipboard
open operator override fun compareTo(other: Date): Int
Link copied to clipboard
fun format(format: DateFormat): String
fun format(format: String): String

Converts this date to String using format for representing it.

Link copied to clipboard
fun Date.inThisWeek(dayOfWeek: DayOfWeek, locale: KlockLocale = KlockLocale.default): Date
Link copied to clipboard
operator fun Date.minus(time: DateTimeSpan): Date
operator fun Date.minus(time: MonthSpan): Date
operator fun Date.minus(time: Time): DateTime
operator fun Date.minus(time: TimeSpan): Date
Link copied to clipboard
operator fun Date.plus(time: DateTimeSpan): Date
operator fun Date.plus(time: MonthSpan): Date
operator fun Date.plus(time: Time): DateTime
operator fun Date.plus(time: TimeSpan): Date
Link copied to clipboard
Link copied to clipboard
open override fun toString(): String

Converts this date to String formatting it like "2020-01-01", "2020-12-31" or "-2020-12-31" if the year is negative