4
 NSTimeZone *timezone = [NSTimeZone systemTimeZone];
 NSString *timeZoneAbberivation = [timezone abbreviation];

timeZoneAbberivation is printing like GMT+5:30 like that. But I need GMT+5:30 to be printed as IST. (IST is of India/Kolkatta).

Suppose if it is America/Newyork time zone, I need it as EST, etc.

2 Answers2

3

You can use an NSDateFormatter. Look into the z format argument which supplies the "short specific non-location format"

NSDateFormatter Date Formatting Table

Stonz2
  • 6,306
  • 4
  • 44
  • 64
0

In Swift you can use this:

let  zone = TimeZone.current.identifier
print(zone)

In Objective-C you can use this:

NSTimeZone* timeZone = [NSTimeZone timeZoneWithAbbreviation:@"IST"];

NSString* timeZoneName = [timeZone localizedName:NSTimeZoneNameStyleStandard 
                                          locale:[NSLocale currentLocale]];
NSLog(@"Name : %@", timeZoneName);
Stonz2
  • 6,306
  • 4
  • 44
  • 64
vikram
  • 181
  • 2
  • 5