Re: Getting time zone abbreviations
Re: Getting time zone abbreviations
- Subject: Re: Getting time zone abbreviations
- From: Rick Mann <email@hidden>
- Date: Fri, 18 Jun 2010 21:25:02 -0700
On Jun 18, 2010, at 21:21:32, David Rowland wrote:
>
> On Jun 18, 2010, at 9:19 PM, Rick Mann wrote:
>
>> On Jun 18, 2010, at 21:15:58, David Rowland wrote:
>>
>>>
>>> On Jun 18, 2010, at 6:38 PM, Rick Mann wrote:
>>>> Is there any way to get short abbreviations for a TimeZone? I need it short due to limited space. I need a common abbreviation due to users not knowing POSIX timezone names.
>>>
>>> this works for me:
>>>
>>> NSTimeZone* theZone;
>>> NSString* zoneAbbreviation;
>>>
>>> theZone = [NSTimeZone timeZoneWithName:tzName];
>>> zoneAbbreviation = [theZone abbreviation];
>>>
>>
>> I've discovered that this seems to be a change between iOS 3.1/3.2 and 4.0.
>>
>> That is, the code works, but does not return the correct values.
>
> If it doesn't return the correct values then it doesn't work. I have not used 4.0 yet, so this goes high on my watch list.
Well, the values are correct in that some time zones return correct abbreviations like PDT, and other time zones return "GMT±HH:MM", depending on the time zone.
Interestingly,
NSTimeZone* tz = [NSTimeZone timeZoneWithName: @"UTC"];
NSString* abv = tz.abbreviation;
returns "GMT+00:00". Not very nice.
--
Rick
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden