Awesome Open Source
Awesome Open Source


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

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 {

// 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:

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
javascript (70,346
kotlin (3,666
jvm (210
native (163
time (163
date (119
clock (55
multiplatform (53