Need help with klock?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

651 Stars 49 Forks Creative Commons Zero v1.0 Universal 545 Commits 17 Opened issues


Multiplatform Date and time library for Kotlin

Services available


Need anything else?

Contributors list


Klock is a Date & Time library for Multiplatform Kotlin.

It is designed to be as allocation-free as possible using Kotlin inline classes, to be consistent and portable across targets since all the code is written in Common Kotlin, and to provide an API that is powerful, fun and easy to use.

Build Status Maven Central Discord

📓 The code has been moved to korlibs/korge-next, so please check it for the latest code.

Full Documentation:

Some samples:

val now =
val duration = 1.seconds
val later = now + 1.months + duration
val is2018Leap = Year(2018).isLeap
val daysInCurrentMonth = now.yearMonth.days
val daysInNextMonth = (now.yearMonth + 1.months).days

Usage with gradle:

def klockVersion = "..." // Find latest version in

repositories { mavenCentral() }

// For multiplatform Kotlin kotlin { sourceSets { commonMain { dependencies { implementation "com.soywiz.korlibs.klock:klock:$klockVersion" // Common } } } }

// For JVM dependencies { implementation "com.soywiz.korlibs.klock:klock-jvm:$klockVersion" }

Testing & Kotest

Kotest is a flexible and comprehensive testing tool for Kotlin with multiplatform support. It supports Klock adding additional matchers. For a full list of Klock Kotest matchers, check this link:

And you can find a sample here:

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.