Information about local time conventions that bridges to
NSTime when you need reference semantics or other Foundation-specific behavior.
- iOS 2.0+
- macOS 10.0+
- tvOS 9.0+
- watchOS 2.0+
Time zones represent the standard time policies for a geopolitical region. Time zones have identifiers like “America/Los_Angeles” and can also be identified by abbreviations, such as PST for Pacific Standard Time. You can create time zone objects by ID with
init(name:) and by abbreviation with
Time zones can also represent a temporal offset—either plus or minus—from Greenwich Mean Time (GMT). For example, the temporal offset of Pacific Standard Time is 8 hours behind Greenwich Mean Time (GMT-8). You can create time zone objects with a temporal offset by using
You typically work with system time zones rather than creating time zones by identifier or by offset. The
system class property returns the time zone currently used by the system, if known. This value is cached once the property is accessed and doesn't reflect any system time zone changes until you call the
reset method. The
local class property returns an autoupdating proxy object that always returns the current time zone used by the system. You can also set the
default class property to make your app run as if it were in a different time zone than the system.