Date and time utilities for Multiplatform Kotlin 1.3: consistent and portable. JVM, JS, Native and Common
Clone or download
soywiz Use microseconds instead of reference that should improve accuracy
Signed-off-by: soywiz <>
Latest commit 794453a Dec 10, 2018


Klock is a Date & Time library for Multiplatform Kotlin 1.3.

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 Version Gitter

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 = "1.0.0"

repositories {
    maven { url "" }

// For multiplatform projects
implementation "com.soywiz:klock:$klockVersion"