Re: NSDate / NSXMLParser
Re: NSDate / NSXMLParser
- Subject: Re: NSDate / NSXMLParser
- From: Chunk 1978 <email@hidden>
- Date: Tue, 3 Nov 2009 13:04:17 -0500
have you tried it on your device?
On Tue, Nov 3, 2009 at 11:26 AM, David Rowland <email@hidden>wrote:
> The SeismicXML sample code uses NSXMLParser to extract data from a file
> downloaded from the USGS. The time of an event appears in the file like
> this,
> .....12:34:32Z....
>
> According to rfc 822 'Z' means UTC (or GMT if you prefer).
>
> I find that the NSDate from the parser is tagged as being in the Pacific
> time zone, my local time zone, while the hours are correct for UTC. That
> makes it 8 hours off for standard time.
>
> The parser is told that the date format is,
> [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss"];
> which seems to ignore the Z and impose local time.
>
> I have tried several variations on that formatting string. They all fail to
> deliver UTC.
>
> [dateFormatter setDateFormat:@"yyyy-MM-dd' 'HH:mm:ssz"]; //says PDT
> [dateFormatter setDateFormat:@"yyyy-MM-dd' 'HH:mm:ssZ"]; //says -0700
> [dateFormatter setDateFormat:@"yyyy-MM-dd' 'HH:mm:sszz"]; //says PDT
> [dateFormatter setDateFormat:@"yyyy-MM-dd' 'HH:mm:ss"]; //says nothing
> but still thinks its PDT
>
> No doubt my inexperience with the parser or NSDate is at fault. How do I
> get the parser to recognize that the time really is UTC?
>
>
> _______________________________________________
>
> 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