NameStyle
Enum you use to specify different name style of a time zone.
- iOS
- 8.0+
- macOS
- 10.10+
- tvOS
- 9.0+
- watchOS
- 2.0+
enum NameStyle
Enum you use to specify different name style of a time zone.
enum NameStyle
import FoundationEssentials
struct TimeZone
TimeZone
defines the behavior of a time zone. Time zone values represent geopolitical regions. Consequently, these values have names for these regions. Time zone values also represent a temporal offset, either plus or minus, from Greenwich Mean Time (GMT) and an abbreviation (such as PST for Pacific Standard Time).
case daylightSaving
Specifies a daylight saving name style. For example, “Central Daylight Time” for Central Time.
case generic
Specifies a generic name style. For example, “Central Time” for Central Time.
case shortDaylightSaving
Specifies a short daylight saving name style. For example, “CDT” for Central Time.
case shortGeneric
Specifies a generic time zone name. For example, “CT” for Central Time.
case shortStandard
Specifies a short name style. For example, “CST” for Central Time.
case standard
Specifies a standard name style. For example, “Central Standard Time” for Central Time.
init?(abbreviation: String)
Returns a time zone identified by a given abbreviation.
init(from decoder: any Decoder) throws
init?(identifier: String)
Returns a time zone initialized with a given identifier.
init?(secondsFromGMT seconds: Int)
Returns a time zone initialized with a specific number of seconds from GMT.
static var abbreviationDictionary: [String : String] { get set }
Returns the mapping of abbreviations to time zone identifiers.
static var autoupdatingCurrent: TimeZone { get }
The time zone currently used by the system, automatically updating to the user’s current preference.
static let cldrKeywordKey: ICUCLDRKey
static var current: TimeZone { get }
The time zone currently used by the system.
static var `default`: TimeZone! { get set }
static var gmt: TimeZone { get }
static let legacyKeywordKey: ICULegacyKey
static func nameForSecondsFromGMT(_ seconds: Int) -> String?
static func tryParseGMTName(_ name: String) -> Int?
var customMirror: Mirror { get }
var debugDescription: String { get }
var description: String { get }
var identifier: String { get }
The geopolitical region identifier that identifies the time zone.
var nextDaylightSavingTimeTransition: Date? { get }
Returns the date of the next (after the current instant) daylight saving time transition for the time zone. Depending on the time zone, the value of this property may represent a change of the time zone’s offset from GMT. Returns nil
if the time zone does not currently observe daylight saving time.
static func == (lhs: TimeZone, rhs: TimeZone) -> Bool
func abbreviation(for date: Date = Date()) -> String?
Returns the abbreviation for the time zone at a given date.
func daylightSavingTimeOffset(for date: Date = Date()) -> TimeInterval
Returns the daylight saving time offset for a given date.
func encode(to encoder: any Encoder) throws
func hash(into hasher: inout Hasher)
func isDaylightSavingTime(for date: Date = Date()) -> Bool
Returns a Boolean value that indicates whether the receiver uses daylight saving time at a given date.
func localizedName(for style: TimeZone.NameStyle, locale: Locale?) -> String?
Returns the name of the receiver localized for a given locale.
func nextDaylightSavingTimeTransition(after date: Date) -> Date?
Returns the next daylight saving time transition after a given date.
func secondsFromGMT(for date: Date = Date()) -> Int
The current difference in seconds between the time zone and Greenwich Mean Time.
enum DaylightSavingTimePolicy
protocol Equatable
A type that can be compared for value equality.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
protocol Sendable
init?(rawValue: Int)
var hashValue: Int { get }
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.
func hash(into hasher: inout Hasher)