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

org.kiwiproject.changelog.extension.DateTimeExtensions.kt Maven / Gradle / Ivy

package org.kiwiproject.changelog.extension

import java.time.Instant
import java.time.ZoneOffset
import java.time.ZonedDateTime
import java.time.temporal.ChronoUnit

fun nowUtcTruncatedToSeconds(): ZonedDateTime =
    nowUtc().truncatedToSeconds()

fun nowUtc(): ZonedDateTime =
    ZonedDateTime.now(ZoneOffset.UTC)

fun ZonedDateTime.truncatedToSeconds(): ZonedDateTime =
    truncatedTo(ChronoUnit.SECONDS)

fun utcZonedDateTimeFromEpochSeconds(epochSeconds: Long): ZonedDateTime =
    Instant.ofEpochSecond(epochSeconds).atZone(ZoneOffset.UTC)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy