core / io.islandtime / TimeZone

TimeZone

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86) sealed class TimeZone : Comparable<TimeZone>

A time zone.

Types

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

FixedOffset

A time zone defined by a fixed offset from UTC.

class FixedOffset : TimeZone
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

Region

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.

class Region : TimeZone

Properties

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

id

An ID that uniquely identifies the time zone.

abstract val id: String
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

isValid

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

abstract val isValid: Boolean
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

rules

The rules associated with this time zone.

abstract val rules: TimeZoneRules

Functions

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

compareTo

open fun compareTo(other: TimeZone): Int

displayName

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.

(jvm) fun displayName(style: TimeZoneTextStyle, locale: Locale = defaultLocale()): String
(iosArm64, iosX64, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86) fun displayName(style: TimeZoneTextStyle, locale: <ERROR CLASS> = defaultLocale()): String

localizedName

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.

(jvm) fun localizedName(style: TimeZoneTextStyle, locale: Locale = defaultLocale()): String?
(iosArm64, iosX64, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86) fun localizedName(style: TimeZoneTextStyle, locale: <ERROR CLASS> = defaultLocale()): String?
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

normalized

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

abstract fun normalized(): TimeZone
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

toString

Returns the id of this time zone.

open fun toString(): String
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

validate

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

fun validate(): Unit
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

validated

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

fun validated(): TimeZone

Companion Object Properties

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

UTC

A fixed time zone representing UTC.

val UTC: TimeZone

Companion Object Functions

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

FixedOffset

Creates a fixed-offset TimeZone from an identifier in the form of +01:00.

fun FixedOffset(id: String): FixedOffset
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

systemDefault

Returns the system's current TimeZone.

fun systemDefault(): TimeZone

Extension Functions

(jvm)

toJavaZoneId

Convert to an equivalent Java ZoneId.

fun TimeZone.toJavaZoneId(): ZoneId

Inheritors

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

FixedOffset

A time zone defined by a fixed offset from UTC.

class FixedOffset : TimeZone
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)

Region

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.

class Region : TimeZone