
jvmMain.io.ktor.util.DatesJvm.kt Maven / Gradle / Ivy
/*
* Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
package io.ktor.util
import java.time.*
import java.util.*
/**
* Creates [LocalDateTime] from this [Date]
*/
@InternalAPI
fun Date.toLocalDateTime(): LocalDateTime = LocalDateTime.ofInstant(toInstant(), ZoneId.systemDefault())
/**
* Creates [ZonedDateTime] from this [Date]
*/
@Suppress("DEPRECATION")
@InternalAPI
fun Date.toZonedDateTime(): ZonedDateTime = ZonedDateTime.ofInstant(toInstant(), GreenwichMeanTime)
/**
* [ZoneId] for GMT
*/
@InternalAPI
val GreenwichMeanTime: ZoneId = ZoneId.of("GMT")
© 2015 - 2025 Weber Informatics LLC | Privacy Policy