All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jdk8Main.common.Timestamp.jvm.kt Maven / Gradle / Ivy

There is a newer version: 0.9.20
Show newest version
package io.fluidsonic.time


actual fun Timestamp.toDayOfWeek(timeZone: TimeZone) =
	toPlatform().atZone(timeZone.toPlatform()).dayOfWeek.toCommon()


actual fun Timestamp.toLocalDate(timeZone: TimeZone) =
	toPlatform().atZone(timeZone.toPlatform()).toLocalDate().toCommon()


actual fun Timestamp.toLocalDateTime(timeZone: TimeZone) =
	toPlatform().atZone(timeZone.toPlatform()).toLocalDateTime().toCommon()


actual fun Timestamp.toLocalTime(timeZone: TimeZone) =
	toPlatform().atZone(timeZone.toPlatform()).toLocalTime().toCommon()


fun Timestamp.toPlatform(): PlatformTimestamp =
	PlatformTimestamp.ofEpochSecond(secondsSince1970.toLong(), partialNanosecond.toLong())


fun PlatformTimestamp.toCommon() =
	Timestamp.of(secondsSince1970 = Seconds(epochSecond), nanoseconds = Nanoseconds(nano))




© 2015 - 2024 Weber Informatics LLC | Privacy Policy