Re: How to get the time zone of a parsed date/time string?
Re: How to get the time zone of a parsed date/time string?
- Subject: Re: How to get the time zone of a parsed date/time string?
- From: Alex Zavatone <email@hidden>
- Date: Wed, 30 Jul 2014 14:48:42 -0400
Actually, there is one line that is relevant, so here it is.
In iOS, NSDateComponents objects can contain a calendar, a timezone, and a date object. You can therefore store the calendar along with the components. If you use the date method of the NSDateComponents class to access the date, make sure that the associated timezone is up-to-date.
On Jul 30, 2014, at 2:43 PM, Alex Zavatone wrote:
> Have you checked out NSDateComponents and NSTimeZone, Jens?
>
> There is a section in the Xcode help that mentions "Creating Dates with Time Zones" and if you search the help, for that string, you should be able to find that.
>
>
>
> On Jul 30, 2014, at 2:24 PM, Jens Alfke wrote:
>
>> After NSDateFormatter parses a date string that includes a time zone, how can the caller determine the time zone? The result is an NSDate object, which is simply a timestamp with no notion of time zone.
>>
>> For example, how does one determine from the string "Wed, 30 Jul 2014 08:21:35 -0700” that the time zone is GMT-7:00?
>>
>> (IIRC, in the olden days NSDateFormatter would return an NSCalendarDate object, which did have a timeZone property, but no more.)
>>
>> —Jens
>> _______________________________________________
>>
>> 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
>
>
> _______________________________________________
>
> 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
_______________________________________________
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