Package io.ktor.util.date

Types

GMTDate

data class GMTDate : Comparable<GMTDate>

Date in GMT timezone

GMTDateParser

class GMTDateParser

Build GMTDate parser using pattern string.

Month

enum class Month

Month value is 3 letter shortcut

WeekDay

enum class WeekDay

Day of week value is 3 letter shortcut

Exceptions

InvalidDateStringException

class InvalidDateStringException : IllegalStateException

Thrown when the date string doesn’t the string pattern.

Extensions for External Classes

java.time.Instant

java.time.ZonedDateTime

java.util.Calendar

Functions

GMTDate

expect fun GMTDate(timestamp: Long? = null): GMTDate

Create new gmt date from the timestamp.

expect fun GMTDate(
    seconds: Int,
    minutes: Int,
    hours: Int,
    dayOfMonth: Int,
    month: Month,
    year: Int
): GMTDate

Create an instance of GMTDate from the specified date/time components

getTimeMillis

expect fun getTimeMillis(): Long

Gets current system time in milliseconds since certain moment in the past, only delta between two subsequent calls makes sense.

minus

operator fun GMTDate.minus(milliseconds: Long): GMTDate

Subtracts the specified number of milliseconds

operator fun GMTDate.minus(duration: <ERROR CLASS>): GMTDate

Subtracts the specified duration

plus

operator fun GMTDate.plus(milliseconds: Long): GMTDate

Adds the specified number of milliseconds

operator fun GMTDate.plus(duration: <ERROR CLASS>): GMTDate

Adds the specified duration

toJvmDate

fun GMTDate.toJvmDate(): Date

Convert to Date

truncateToSeconds

fun GMTDate.truncateToSeconds(): GMTDate

Truncate to seconds by discarding sub-second part