- Inherits from:
- NSObject
- Conforms to:
- NSCoding
- NSCopying
- NSObject (NSObject)
Declared in:
- Foundation/NSTimeZone.h
NSTimeZone 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").
NSTimeZone provides several class methods to get time zone objects: timeZoneWithName:, timeZoneWithAbbreviation:, timeZoneForSecondsFromGMT: . The class also permits you to set the default time zone within your application ( setDefaultTimeZone:). You can access this default time zone at any time with the defaultTimeZone class method, and with the localTimeZone 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.
Some NSCalendarDate methods return date objects that are automatically bound to time zone objects. These date objects use the functionality of NSTimeZone to adjust dates for the proper locale. Unless you specify otherwise, objects returned from NSCalendarDate are bound to the default time zone for the current locale.
NSCoding
- - encodeWithCoder:
- - initWithCoder:
NSCopying
- - copyWithZone:
- Getting time zones
- + timeZoneWithAbbreviation:
- + timeZoneWithName:
- + timeZoneWithName:data:
- + timeZoneForSecondsFromGMT:
- - initWithName:
- - initWithName:data:
- Getting the default time zone
- + localTimeZone
- + defaultTimeZone
- + setDefaultTimeZone:
- + resetSystemTimeZone
- Getting time zone information
- + abbreviationDictionary
- + knownTimeZoneNames
- Getting information about a specific time zone
- - abbreviation
- - abbreviationForDate:
- - name
- - secondsFromGMT
- - secondsFromGMTForDate:
- - isDaylightSavingTime
- - isDaylightSavingTimeForDate:
- - data
- Comparing time zones
- - isEqualToTimeZone:
- Describing a time zone
- - description
+ (NSDictionary *)abbreviationDictionary
More than one time zone may have the same abbreviation. For example, US/Pacific and Canada/Pacific both use the abbreviation "PST." In these cases abbreviationDictionary chooses a single name to map the abbreviation to.
+ (NSTimeZone *)defaultTimeZone
See Also: + localTimeZone, + setDefaultTimeZone:, + systemTimeZone
+ (NSArray *)knownTimeZoneNames
+ (NSTimeZone *)localTimeZone
See Also: + defaultTimeZone, + setDefaultTimeZone:
+ (void)resetSystemTimeZone
+ (void)setDefaultTimeZone:(NSTimeZone
*)aTimeZone
See Also: + defaultTimeZone, + localTimeZone
+ (NSTimeZone *)systemTimeZone
+ (NSTimeZone *)timeZoneForSecondsFromGMT:(int)seconds
See Also: + timeZoneWithAbbreviation:, + timeZoneWithName:
+ (NSTimeZone *)timeZoneWithAbbreviation:(NSString
*)abbreviation
nil
if there
is no match for abbreviation. See Also: + abbreviationDictionary, + timeZoneForSecondsFromGMT:, + timeZoneWithName:
+ (NSTimeZone *)timeZoneWithName:(NSString
*)aTimeZoneName
nil
if there
is no match on the name. See Also: + timeZoneForSecondsFromGMT:, + timeZoneWithAbbreviation:, + knownTimeZoneNames
+ (NSTimeZone *)timeZoneWithName:(NSString
*)aTimeZoneName
data:(NSData *)data
See Also: + timeZoneWithName:
- (NSString *)abbreviation
- (NSString *)abbreviationForDate:(NSDate
*)aDate
- (NSData *)data
- (NSString *)description
- (id)initWithName:(NSString
*)aName
- (id)initWithName:(NSString
*)aName
data:(NSData *)data
- (BOOL)isDaylightSavingTime
YES
if
the time zone is currently using Daylight Savings Time. This
method invokes isDaylightSavingTimeForDate: with
the current date as the argument.- (BOOL)isDaylightSavingTimeForDate:(NSDate
*)aDate
YES
if
the time zone uses Daylight Savings Time at aDate.- (BOOL)isEqualToTimeZone:(NSTimeZone
*)aTimeZone
YES
if aTimeZone and
the receiving time zone have the same name and data.- (NSString *)name
- (int)secondsFromGMT
- (int)secondsFromGMTForDate:(NSDate
*)aDate