toJavaInstant
Converts this kotlin.time.Instant value to a java.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 Kotlin Instant.
val kotlinInstant = Instant.fromEpochMilliseconds(10)
// It can be converted to a corresponding Java Instant.
val javaInstant = kotlinInstant.toJavaInstant()
// The Java Instant will represent the same moment in time,
// and can be passed to APIs that expect a Java Instant.
println(javaInstant.toEpochMilli()) // 10
//sampleEnd
}