Return the civil date/time value that this instant has in the time zone provided as an implicit receiver.

Note that while this conversion is unambiguous, the inverse (LocalDateTime.toInstant) is not necessary so.

See also


if this value is too large to fit in LocalDateTime.


import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.test.*
fun main() { 
   // Converting an instant to a local date-time in a specific time zone
val zone = TimeZone.of("America/New_York")
val instant = Instant.parse("2023-06-02T12:30:00Z")
val localDateTime = with(zone) {
check(localDateTime == LocalDate(2023, 6, 2).atTime(8, 30))