NSTime is an abstract class that defines the behavior of time zone objects. Time zone objects represent geopolitical regions. Consequently, these objects have names for these regions. Time zone objects also represent a temporal offset, either plus or minus, from Greenwich Mean Time (GMT) and an abbreviation (such as PST for Pacific Standard Time).
- iOS 2.0+
- macOS 10.0+
- tvOS 9.0+
- watchOS 2.0+
NSTime provides several class methods to get time zone objects:
init(for. The class also permits you to set the default time zone within your application (setDefault(_:)). You can access this default time zone at any time with the
default class method, and with the
local class method, you can get a relative time zone object that decodes itself to become the default time zone for any locale in which it finds itself.
Note that, strictly, time zone database entries such as “America/Los_Angeles” are IDs not names. An example of a time zone name is “Pacific Daylight Time”. Although many
NSTime method names include the word “name”, they refer to IDs.
Cocoa does not provide any API to change the time zone of the computer, or of other applications.