todayIn

Returns the current date at the given time zone, according to this Clock.

The time zone is important because the current date is not the same in all time zones at the same instant.

Samples

import kotlinx.datetime.*
import kotlin.test.*
fun main() { 
   //sampleStart 
   // Getting the current date in different time zones
val clock = object : Clock {
    override fun now(): Instant = Instant.parse("2020-01-01T02:00:00Z")
}
check(clock.todayIn(TimeZone.UTC) == LocalDate(2020, 1, 1))
check(clock.todayIn(TimeZone.of("America/New_York")) == LocalDate(2019, 12, 31)) 
   //sampleEnd
}