【Foundation-72-2】NSTimeZone - 属性

来源:互联网 发布:航天科工33所 知乎 编辑:程序博客网 时间:2024/05/23 20:51


@interface NSTimeZone (NSExtendedTimeZone)


+ (NSTimeZone *)systemTimeZone;系统时区

+ (void)resetSystemTimeZone;


+ (NSTimeZone *)defaultTimeZone;默认时区

+ (void)setDefaultTimeZone:(NSTimeZone *)aTimeZone;


+ (NSTimeZone *)localTimeZone;本地时区


+ (NSArray *)knownTimeZoneNames;

    NSArray *arr = NSTimeZone.knownTimeZoneNames;        for (NSUInteger a = 0; a < arr.count; a++) {        NSLog(@"%@",[arr objectAtIndex:a]);            }




+ (NSDictionary *)abbreviationDictionary;

+ (void)setAbbreviationDictionary:(NSDictionary *)dictNS_AVAILABLE(10_6,4_0);

    NSDictionary *dic = NSTimeZone.abbreviationDictionary;    NSLog(@"%@",dic);



+ (NSString *)timeZoneDataVersionNS_AVAILABLE(10_6,4_0);

    NSString *string = NSTimeZone.timeZoneDataVersion;




@property (readonly)NSInteger secondsFromGMT;时差

@property (readonly,copy) NSString *abbreviation;简称

@property (readonly,getter=isDaylightSavingTime) BOOL daylightSavingTime; 夏时令

@property (readonly)NSTimeInterval daylightSavingTimeOffset NS_AVAILABLE(10_5, 2_0); // 

@property (readonly,copy) NSDate *nextDaylightSavingTimeTransitionNS_AVAILABLE(10_5,2_0); // 


@property (readonly,copy) NSString *description;


是否一致

- (BOOL)isEqualToTimeZone:(NSTimeZone *)aTimeZone;


typedefNS_ENUM(NSInteger, NSTimeZoneNameStyle) {

NSTimeZoneNameStyleStandard,// Central Standard Time

NSTimeZoneNameStyleShortStandard,// CST

NSTimeZoneNameStyleDaylightSaving,// Central Daylight Time

NSTimeZoneNameStyleShortDaylightSaving,// CDT

NSTimeZoneNameStyleGeneric,// Central Time

NSTimeZoneNameStyleShortGeneric// CT

};


- (NSString *)localizedName:(NSTimeZoneNameStyle)style locale:(NSLocale *)locale NS_AVAILABLE(10_5,2_0);


@end



0 0
原创粉丝点击