systemTimeZone
Returns the time zone currently used by the system.
+ (NSTimeZone *)systemTimeZone
Return Value
The time zone currently used by the system. If the current time zone cannot be determined, returns the GMT time zone.
Special Considerations of [NSTimeZone systemTimeZone]
If you get the system time zone, it is cached by the application and does not change if the user subsequently changes the system time zone. The next time you invoke
systemTimeZone
, you get back the same time zone you originally got. You have to invoke resetSystemTimeZone
to clear the cached object.
Example of [NSTimeZone systemTimeZone]
NSTimeZone *localTime = [NSTimeZone systemTimeZone];
NSLog(@" - current local timezone is %@",localTime);
Example of [NSTimeZone systemTimeZone]
NSTimeZone *localTime = [NSTimeZone systemTimeZone];
NSLog(@" - current local timezone is %@",[localTime abbreviation]);