Kotlinx Datetime

Dependency

Add the following to your dependencies

implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.2.0")

Usage

import kotlinx.datetime.*
val today = Clock.System.todayAt(TimeZone.currentSystemDefault())

If you target Android devices running below API 26, you need to use Android Gradle plugin 4.0 or newer and enable core library desugaring.

https://github.com/Kotlin/kotlinx-datetime