second
The second of minute.
By default, it's zero-padded to two digits, but this can be changed with padding.
This field has the default value of 0. If you want to omit it, use optional.
Samples
import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.test.*
fun main() {
//sampleStart
// Defining a custom format for the local time
// format the local time as a single number
val format = LocalTime.Format {
hour(); minute(); second()
optional { char('.'); secondFraction(1, 9) }
}
val formatted = format.format(LocalTime(9, 34, 58, 120_000_000))
check(formatted == "093458.12")
//sampleEnd
}