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

net.dankito.utils.datetime.DateExtensions.kt Maven / Gradle / Ivy

There is a newer version: 1.0.20
Show newest version
package net.dankito.utils.datetime

import java.time.LocalDate
import java.time.LocalDateTime
import java.time.ZoneId
import java.util.*


@JvmName("asNullableLocalDate")
fun Date?.asLocalDate(zone: ZoneId = ZoneId.systemDefault()): LocalDate? {
    return DateConvertUtils.asLocalDate(this, zone)
}

fun Date.asLocalDate(zone: ZoneId = ZoneId.systemDefault()): LocalDate {
    return DateConvertUtils.asLocalDate(this, zone)
}


@JvmName("asNullableLocalDateTime")
fun Date?.asLocalDateTime(zone: ZoneId = ZoneId.systemDefault()): LocalDateTime? {
    return DateConvertUtils.asLocalDateTime(this, zone)
}

fun Date.asLocalDateTime(zone: ZoneId = ZoneId.systemDefault()): LocalDateTime {
    return DateConvertUtils.asLocalDateTime(this, zone)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy