date

abstract fun date(format: DateTimeFormat<LocalDate>)(source)

An existing DateTimeFormat for the date part.

Samples

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

fun main() { 
   //sampleStart 
   // Using a predefined format for a date in a larger custom format
val format = LocalDateTime.Format {
    date(LocalDate.Formats.ISO)
    alternativeParsing({ char('t') }) { char('T') }
    hour(); char(':'); minute()
}
check(format.format(LocalDateTime(2021, 1, 13, 14, 30)) == "2021-01-13T14:30") 
   //sampleEnd
}