# Exposed-kotlin-datetime

**URL:** <https://discuss.kotlinlang.org/t/exposed-kotlin-datetime/22976>\
**Category:** Libraries\
**Created:** [September 18, 2021, 5:35pm UTC](https://discuss.kotlinlang.org/t/exposed-kotlin-datetime/22976 "2021-09-18T17:35:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![huggy](https://avatars.discourse-cdn.com/v4/letter/h/ed8c4c/32.png) [@huggy](https://discuss.kotlinlang.org/u/huggy)\
**Post date:** [September 18, 2021, 5:35pm UTC](https://discuss.kotlinlang.org/t/exposed-kotlin-datetime/22976/1 "2021-09-18T17:35:22Z")

</div>

i see this module in the exposed source, yet i cannot find it in any maven repository. How can i use use this. The library basically lets us use the kotlin localdatetime instead of the java version.

---

<div class="post-metadata">

**Author:** ![tothiz](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/tothiz/32/10355_2.png) [@tothiz](https://discuss.kotlinlang.org/u/tothiz)\
**Post date:** [September 19, 2021, 8:33am UTC](https://discuss.kotlinlang.org/t/exposed-kotlin-datetime/22976/2 "2021-09-19T08:33:00Z")

</div>

It “just works”.

Note: this is code generated from a schema, so it uses the framework it is generated for. Nevertheless, it should answer your question.

```kotlin
package a

import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.sql.statements.UpdateBuilder
import zakadabar.core.persistence.exposed.entityId
import zakadabar.core.persistence.exposed.ExposedPaBase
import zakadabar.core.persistence.exposed.ExposedPaTable
import a.b
import org.jetbrains.exposed.sql.`java-time`.date
import kotlinx.datetime.toJavaLocalDate
import kotlinx.datetime.toKotlinLocalDate
import org.jetbrains.exposed.sql.`java-time`.datetime
import kotlinx.datetime.toJavaLocalDateTime
import kotlinx.datetime.toKotlinLocalDateTime
import org.jetbrains.exposed.sql.`java-time`.timestamp
import kotlinx.datetime.toJavaInstant
import kotlinx.datetime.toKotlinInstant

open class bPa(
    table : bTable = bTable()
) : ExposedPaBase<b,bTable>(
    table = table
) {
    override fun ResultRow.toBo() = b(
        id = this[table.id].entityId(),
        localdate = this[table.localdate].toKotlinLocalDate(),
        datetime = this[table.datetime].toKotlinLocalDateTime(),
        instant = this[table.instant].toKotlinInstant()
    )  

    override fun UpdateBuilder<*>.fromBo(bo: b) {
        this[table.localdate] = bo.localdate.toJavaLocalDate()
        this[table.datetime] = bo.datetime.toJavaLocalDateTime()
        this[table.instant] = bo.instant.toJavaInstant()
    }
}

open class bTable(
    tableName : String = "b"
) : ExposedPaTable<b>(
    tableName = tableName
) {

    val localdate = date("localdate")
    val datetime = date("datetime")
    val instant = timestamp("instant")

}

```

---

<div class="post-metadata">

**Author:** ![TaQuangKhoi](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/taquangkhoi/32/11335_2.png) [@TaQuangKhoi](https://discuss.kotlinlang.org/u/TaQuangKhoi)\
**Post date:** [November 19, 2025, 8:56am UTC](https://discuss.kotlinlang.org/t/exposed-kotlin-datetime/22976/3 "2025-11-19T08:56:12Z")

</div>

As of 2025, we have this documentation:

> **[Date and time | Exposed](https://www.jetbrains.com/help/exposed/date-and-time-types.html)**
