TimeZone

sealed class TimeZone : Comparable<TimeZone>

A time zone.

Types

Companion
Link copied to clipboard
common
object Companion
FixedOffset
Link copied to clipboard
common
class FixedOffset : TimeZone

A time zone defined by a fixed offset from UTC.

Region
Link copied to clipboard
common
class Region : TimeZone

A named time zone, typically corresponding to a region identifier in the IANA Time Zone Database, but may be any name that can be understood by a TimeZoneRulesProvider.

Functions

compareTo
Link copied to clipboard
common
open operator override fun compareTo(other: TimeZone): Int
displayName
Link copied to clipboard
common
fun displayName(style: TimeZoneTextStyle, locale: Locale): String

A textual representation of this time zone, suitable for display purposes. The localized name will be returned, if available for the locale in the specified style. If not, the id will be returned instead.

localizedName
Link copied to clipboard
common
fun localizedName(style: TimeZoneTextStyle, locale: Locale): String?

The localized name of this time zone, if available for the locale in the specified style. The result depends on the configured TimeZoneTextProvider and may differ between platforms.

normalized
Link copied to clipboard
common
abstract fun normalized(): TimeZone

Returns a normalized time zone, converting any zone with a fixed offset to use a consistent identifier.

toString
Link copied to clipboard
common
open override fun toString(): String

Returns the id of this time zone.

validate
Link copied to clipboard
common
fun validate()

Checks if this time zone is valid and throws an exception if it isn't.

validated
Link copied to clipboard
common
fun validated(): TimeZone

Ensures that this time zone is valid, throwing an exception if it isn't.

Properties

id
Link copied to clipboard
common
abstract val id: String

An ID that uniquely identifies the time zone.

isValid
Link copied to clipboard
common
abstract val isValid: Boolean

Checks if this is a valid time zone according to the current time zone rules provider.

rules
Link copied to clipboard
common
abstract val rules: TimeZoneRules

The rules associated with this time zone.

Inheritors

TimeZone
Link copied to clipboard
TimeZone
Link copied to clipboard

Extensions

toJavaZoneId
Link copied to clipboard
fun TimeZone.toJavaZoneId(): ZoneId

Converts this time zone to an equivalent Java ZoneId.

toNSTimeZone
Link copied to clipboard
darwin
fun TimeZone.toNSTimeZone(): <ERROR CLASS>

Converts this time zone to an NSTimeZone.

toNSTimeZoneOrNull
Link copied to clipboard
darwin
fun TimeZone.toNSTimeZoneOrNull(): <ERROR CLASS>?

Converts this time zone to an NSTimeZone, or null if the identifier isn't recognized as valid for an NSTimeZone.