Anonymous contributor's avatar
Anonymous contributor
Anonymous contributor's avatar
Anonymous contributor
Published Nov 29, 2023
Contribute to Docs

The .todayIn() method returns a date when called on a Clock while passing a TimeZone argument.


  • myClock: A Clock providing a source for Instants (e.g., 2023-11-21, 00:00:00 UTC+0). Clock.System is the clock that refers to the current platform for the current time.
  • myTimeZone: An instance of the TimeZone class (e.g., America/Los_Angeles).


The example below demonstrates a basic implementation of .todayIn that returns the current date.

// Import all classes from kotlinx.datetime package.
import kotlinx.datetime.*
fun main() {
val myLocalDate = Clock.System.todayIn(timeZone = TimeZone.currentSystemDefault())

This example results in an output similar to the following:


All contributors

Looking to contribute?

Learn Kotlin on Codecademy