Dates with kotlinx-datetime
A multiplatform-safe way to handle time and dates.
Dates Need a Library
The core stdlib has no shared date type, so KMP uses kotlinx-datetime, an official multiplatform library for time.
Add the Dependency
You pull kotlinx-datetime into commonMain in your build file, and then every target can work with dates the same way.
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.0")All lessons in this course
- Strings, Numbers & Collections Everywhere
- map, filter & fold in Shared Code
- Dates with kotlinx-datetime
- What Is NOT in Common stdlib