LocalDateTime

expect class LocalDateTime(date: LocalDate, time: LocalTime) : Comparable<LocalDateTime>

The representation of a specific civil date and time without a reference to a particular time zone.

This class does not describe specific moments in time, which are represented as Instant values. Instead, its instances can be thought of as clock readings, something that an observer in a particular time zone could witness. For example, 2020-08-30T18:43 is not a moment in time, since someone in Berlin and someone in Tokyo would witness this on their clocks at different times.

The main purpose of this class is to provide human-readable representations of Instant values, or to transfer them as data.

The arithmetic on LocalDateTime values is not provided, since without accounting for the time zone transitions it may give misleading results.

actual class LocalDateTime(date: LocalDate, time: LocalTime) : Comparable<LocalDateTime>
actual class LocalDateTime(date: LocalDate, time: LocalTime) : Comparable<LocalDateTime>
actual class LocalDateTime(val date: LocalDate, val time: LocalTime) : Comparable<LocalDateTime>

Constructors

Link copied to clipboard
expect fun LocalDateTime(    year: Int,     monthNumber: Int,     dayOfMonth: Int,     hour: Int,     minute: Int,     second: Int = 0,     nanosecond: Int = 0)

Constructs a LocalDateTime instance from the given date and time components.

actual fun LocalDateTime(    year: Int,     monthNumber: Int,     dayOfMonth: Int,     hour: Int,     minute: Int,     second: Int,     nanosecond: Int)
actual fun LocalDateTime(    year: Int,     monthNumber: Int,     dayOfMonth: Int,     hour: Int,     minute: Int,     second: Int,     nanosecond: Int)
actual fun LocalDateTime(    year: Int,     monthNumber: Int,     dayOfMonth: Int,     hour: Int,     minute: Int,     second: Int,     nanosecond: Int)
Link copied to clipboard
expect fun LocalDateTime(    year: Int,     month: Month,     dayOfMonth: Int,     hour: Int,     minute: Int,     second: Int = 0,     nanosecond: Int = 0)

Constructs a LocalDateTime instance from the given date and time components.

actual fun LocalDateTime(    year: Int,     month: Month,     dayOfMonth: Int,     hour: Int,     minute: Int,     second: Int,     nanosecond: Int)
actual fun LocalDateTime(    year: Int,     month: Month,     dayOfMonth: Int,     hour: Int,     minute: Int,     second: Int,     nanosecond: Int)
Link copied to clipboard
expect fun LocalDateTime(date: LocalDate, time: LocalTime)

Constructs a LocalDateTime instance by combining the given date and time parts.

actual fun LocalDateTime(date: LocalDate, time: LocalTime)
actual fun LocalDateTime(date: LocalDate, time: LocalTime)
actual fun LocalDateTime(date: LocalDate, time: LocalTime)

Types

Link copied to clipboard
expect object Companion
actual object Companion
actual object Companion
actual object Companion

Functions

Link copied to clipboard
expect open operator override fun compareTo(other: LocalDateTime): Int

Compares this date/time value with the other date/time value. Returns zero if this value is equal to the other, a negative number if this value represents earlier civil time than the other, and a positive number if this value represents later civil time than the other.

actual open operator override fun compareTo(other: LocalDateTime): Int
actual open operator override fun compareTo(other: LocalDateTime): Int
actual open operator override fun compareTo(other: LocalDateTime): Int
equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
open operator override fun equals(other: Any?): Boolean
open operator override fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
open override fun hashCode(): Int
open override fun hashCode(): Int
open override fun hashCode(): Int
Link copied to clipboard
expect open override fun toString(): String

Converts this date/time value to the ISO-8601 string representation.

actual open override fun toString(): String
actual open override fun toString(): String
actual open override fun toString(): String

Properties

Link copied to clipboard
expect val date: LocalDate

Returns the date part of this date/time value.

actual val date: LocalDate
actual val date: LocalDate
actual val date: LocalDate
Link copied to clipboard
expect val dayOfMonth: Int

Returns the day-of-month component of the date.

actual val dayOfMonth: Int
actual val dayOfMonth: Int
actual val dayOfMonth: Int
Link copied to clipboard
expect val dayOfWeek: DayOfWeek

Returns the day-of-week component of the date.

actual val dayOfWeek: DayOfWeek
actual val dayOfWeek: DayOfWeek
actual val dayOfWeek: DayOfWeek
Link copied to clipboard
expect val dayOfYear: Int

Returns the day-of-year component of the date.

actual val dayOfYear: Int
actual val dayOfYear: Int
actual val dayOfYear: Int
Link copied to clipboard
expect val hour: Int

Returns the hour-of-day time component of this date/time value.

actual val hour: Int
actual val hour: Int
actual val hour: Int
Link copied to clipboard
expect val minute: Int

Returns the minute-of-hour time component of this date/time value.

actual val minute: Int
actual val minute: Int
actual val minute: Int
Link copied to clipboard
expect val month: Month

Returns the month (Month) component of the date.

actual val month: Month
actual val month: Month
actual val month: Month
Link copied to clipboard
expect val monthNumber: Int

Returns the number-of-month (1..12) component of the date.

actual val monthNumber: Int
actual val monthNumber: Int
actual val monthNumber: Int
Link copied to clipboard
expect val nanosecond: Int

Returns the nanosecond-of-second time component of this date/time value.

actual val nanosecond: Int
actual val nanosecond: Int
actual val nanosecond: Int
Link copied to clipboard
expect val second: Int

Returns the second-of-minute time component of this date/time value.

actual val second: Int
actual val second: Int
actual val second: Int
Link copied to clipboard
expect val time: LocalTime

Returns the time part of this date/time value.

actual val time: LocalTime
actual val time: LocalTime
actual val time: LocalTime
Link copied to clipboard
expect val year: Int

Returns the year component of the date.

actual val year: Int
actual val year: Int
actual val year: Int

Extensions

Link copied to clipboard
expect fun LocalDateTime.toInstant(timeZone: TimeZone): Instant

Returns an instant that corresponds to this civil date/time value in the specified timeZone.

expect fun LocalDateTime.toInstant(offset: UtcOffset): Instant

Returns an instant that corresponds to this civil date/time value that happens at the specified UTC offset.

actual fun LocalDateTime.toInstant(timeZone: TimeZone): Instant
actual fun LocalDateTime.toInstant(offset: UtcOffset): Instant
actual fun LocalDateTime.toInstant(timeZone: TimeZone): Instant
actual fun LocalDateTime.toInstant(offset: UtcOffset): Instant
actual fun LocalDateTime.toInstant(timeZone: TimeZone): Instant
actual fun LocalDateTime.toInstant(offset: UtcOffset): Instant
Link copied to clipboard
fun LocalDateTime.toJavaLocalDateTime(): LocalDateTime
Link copied to clipboard
fun LocalDateTime.toNSDateComponents(): <Error class: unknown class>

Converts the given LocalDate to NSDateComponents.