How to get the full name of the ios time zone

How to get the full timezone name in iOS , like Indian Standard Time instead of IST.

NSTimezone *timeZone=[NSTimeZone localTimeZone]; 

I get GMT, but I want it to be like a full line of form

+8
source share
3 answers

You can get the name from the name property:

  NSTimeZone *timeZone = [NSTimeZone localTimeZone]; NSLog(@"Name: %@", timeZone.name); 

Result:

 2015-07-10 13:31:46.292 APP[2904:50429] Name : Asia/Calcutta 

You can get the name with the desired NSTimeZoneNameStyle style using - localizedName:locale:

 NSTimeZone* timeZone = [NSTimeZone timeZoneWithAbbreviation:@"IST"]; NSString* timeZoneName = [timeZone localizedName:NSTimeZoneNameStyleStandard locale:[NSLocale currentLocale]]; NSLog(@"Name : %@", timeZoneName); 

Result:

 2015-07-10 13:36:31.771 APP[2940:51197] Name : India Standard Time 

If you [NSTimeZone abbreviationDictionary] you will get a dictionary containing all available abbreviations.

 NSLog(@"%@",[NSTimeZone abbreviationDictionary]); 

Result:

 2015-07-10 11:44:05.954 APP[1472:26120] { ADT = "America/Halifax"; AKDT = "America/Juneau"; AKST = "America/Juneau"; ART = "America/Argentina/Buenos_Aires"; AST = "America/Halifax"; BDT = "Asia/Dhaka"; BRST = "America/Sao_Paulo"; BRT = "America/Sao_Paulo"; BST = "Europe/London"; CAT = "Africa/Harare"; CDT = "America/Chicago"; CEST = "Europe/Paris"; CET = "Europe/Paris"; CLST = "America/Santiago"; CLT = "America/Santiago"; COT = "America/Bogota"; CST = "America/Chicago"; EAT = "Africa/Addis_Ababa"; EDT = "America/New_York"; EEST = "Europe/Istanbul"; EET = "Europe/Istanbul"; EST = "America/New_York"; GMT = GMT; GST = "Asia/Dubai"; HKT = "Asia/Hong_Kong"; HST = "Pacific/Honolulu"; ICT = "Asia/Bangkok"; IRST = "Asia/Tehran"; IST = "Asia/Calcutta"; JST = "Asia/Tokyo"; KST = "Asia/Seoul"; MDT = "America/Denver"; MSD = "Europe/Moscow"; MSK = "Europe/Moscow"; MST = "America/Denver"; NZDT = "Pacific/Auckland"; NZST = "Pacific/Auckland"; PDT = "America/Los_Angeles"; PET = "America/Lima"; PHT = "Asia/Manila"; PKT = "Asia/Karachi"; PST = "America/Los_Angeles"; SGT = "Asia/Singapore"; UTC = UTC; WAT = "Africa/Lagos"; WEST = "Europe/Lisbon"; WET = "Europe/Lisbon"; WIT = "Asia/Jakarta"; } 
+12
source

Try it;

 NSTimeZone* timeZone = [NSTimeZone localTimeZone]; NSString* timeZoneName = [timeZone localizedName:NSTimeZoneNameStyleStandard locale:[NSLocale currentLocale]]; NSLog(@"timeZoneName : %@", timeZoneName); 
+8
source

I think you are looking for it.

 NSDictionary *tempDict = [NSTimeZone abbreviationDictionary]; NSTimeZone* timeZone; NSString* timeZoneName; for(NSString *str in tempDict){ timeZone = [NSTimeZone timeZoneWithAbbreviation:str]; timeZoneName = [timeZone localizedName:NSTimeZoneNameStyleStandard locale:[NSLocale currentLocale]]; NSLog(@"%@ --- %@", timeZoneName,timeZone); } 

The output will be like ...

Eastern Standard Time --- Offset / Of./Of-Of-Of-Of-Of-Of-Of-Of-14400 (Daylight) Atlantic Standard Time --- America / Halifax (ADT) Offset -10800 (Daytime) shine)

+1
source

All Articles