The postgresql Timestamp with Time Zone
data type needs to be supplied an OffsetDateTime
when being called using a High level language like Kotlin.
I could not find a direct method that supports Epoch to OffsetDateTime conversion.
fun convertEpochToOffsetDateTime(epochValue: Long): OffsetDateTime {
return OffsetDateTime.of(LocalDateTime.ofEpochSecond(epochValue, 0, ZoneOffset.UTC), ZoneOffset.UTC)
}
Btw, I'm using Jooq for SQL queries using Kotlin. The above works like a charm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With