Question

Is there a way to lookup a timezone abbreviation when only the temporal offset is known?

Example: Say i'm given the offset of GMT -5, i'd like to display the abbreviation of EST (assuming US) as apposed to GMT -5.

If you initialize a NSTimeZone object with [NSTimeZone timeZoneWithName:@"America/Argentina/Buenos_Aires"], you can get the correct abbreviation by [myTzVar abbreviation];

However, if you initialize it using secondsFromGMT, the abbreviation is always something like "GMT -XXX".

Was it helpful?

Solution

The problem lies in daylight savings time: this can be different for countries that have the same GMT offset. That is why the abbreviation can only be known if you give the full name instead of just the GMT offset.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top