On Jul 30, 2014, at 12:24 PM, Jens Alfke <[email protected]> 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.)

If you drop down to C you could use strptime() to get a struct tm that has the 
tm_zone member for time zone string. It might also have a tm_gmtoff member, 
which shows the UTF offset in seconds. As mentioned previously, you may not get 
a correct time zone for a GMT offset.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to