TimeZone¶
@Serializable(with = TimeZoneSerializer::class)
sealed class TimeZone : Comparable<TimeZone>
A time zone.
Inheritors¶
| Region |
| FixedOffset |
Types¶
| Name | Summary |
|---|---|
| Companion | common object Companion |
| FixedOffset | common class FixedOffset : TimeZoneA time zone defined by a fixed offset from UTC. |
| Region | common class Region : TimeZoneA 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. |
Properties¶
| Name | Summary |
|---|---|
| id | common abstract val id: StringAn ID that uniquely identifies the time zone. |
| isValid | common abstract val isValid: BooleanChecks if this is a valid time zone according to the current time zone rules provider. |
| rules | common abstract val rules: TimeZoneRulesThe rules associated with this time zone. |
Functions¶
| Name | Summary |
|---|---|
| compareTo | common open operator override fun compareTo(other: TimeZone): Int |
| displayName | common fun displayName(style: TimeZoneTextStyle, locale: Locale): StringA 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 | 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 | common abstract fun normalized(): TimeZoneReturns a normalized time zone, converting any zone with a fixed offset to use a consistent identifier. |
| toJavaZoneId | jvm fun TimeZone.toJavaZoneId(): ZoneIdConverts this time zone to an equivalent Java ZoneId. |
| toNSTimeZone | darwin fun TimeZone.toNSTimeZone(): <Error class: unknown class>Converts this time zone to an NSTimeZone. |
| toNSTimeZoneOrNull | darwin fun TimeZone.toNSTimeZoneOrNull(): <Error class: unknown class>?Converts this time zone to an NSTimeZone, or null if the identifier isn't recognized as valid for an NSTimeZone. |
| toString | common open override fun toString(): StringReturns the id of this time zone. |
| validate | common fun validate()Checks if this time zone is valid and throws an exception if it isn't. |
| validated | common fun validated(): TimeZoneEnsures that this time zone is valid, throwing an exception if it isn't. |