time

abstract fun time(format: DateTimeFormat<LocalTime>)(source)

An existing DateTimeFormat for the time part.

Samples

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

fun main() { 
   //sampleStart 
   // Using a predefined format for the local time
val format = LocalDateTime.Format {
    date(LocalDate.Formats.ISO)
    char(' ')
    time(LocalTime.Formats.ISO)
}
val formatted = format.format(LocalDateTime(2021, 1, 13, 9, 34, 58, 120_000_000))
check(formatted == "2021-01-13 09:34:58.12") 
   //sampleEnd
}