문제

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".

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top