toString

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

Converts this date to the extended ISO 8601 string representation.

See also

for the format details.

for the dual operation: obtaining LocalDate from a string.

for formatting using a custom format.

Samples

import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.random.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   // Converting LocalDate values to strings
check(LocalDate(2024, 4, 16).toString() == "2024-04-16")
check(LocalDate(12024, 4, 16).toString() == "+12024-04-16")
check(LocalDate(-2024, 4, 16).toString() == "-2024-04-16") 
   //sampleEnd
}
actual open override fun toString(): String(source)
actual open override fun toString(): String(source)