toKotlinInstant
Converts this java.time.Instant value to a kotlin.time.Instant value.
Since Kotlin
2.1Samples
import kotlin.test.*
import kotlin.time.*
import kotlin.time.Duration.Companion.hours
import kotlin.time.Duration.Companion.nanoseconds
fun main() {
//sampleStart
// Given a Java Instant.
val javaInstant = java.time.Instant.ofEpochMilli(10)
// It can be converted to a corresponding Kotlin Instant.
val kotlinInstant = javaInstant.toKotlinInstant()
// The Kotlin Instant will represent the same moment in time,
// and can be passed to APIs that expect a Kotlin Instant.
println(kotlinInstant.toEpochMilliseconds()) // 10
//sampleEnd
}