Re: NSDate / NSXMLParser

2009-11-04 Thread David Rowland
On Nov 4, 2009, at 2:48 AM, Alexander Spohr wrote: The parser CAN parse the timezone and adjust the date accordingly. To parse this date: 20091021T121942+0200 I use this format: MMdd'T'HHmmssZZZ and it works fine. The only thing you need is to find the right timezone format string. Yours

Re: NSDate / NSXMLParser

2009-11-04 Thread David Rowland
On Nov 4, 2009, at 1:49 AM, Ingvar Nedrebo wrote: The easiest way is to set the timezone on the formatter: [dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]]; Yes! That works. I'm sure I tried it, but I must have misinterpreted the results. _

Re: NSDate / NSXMLParser

2009-11-04 Thread Alexander Spohr
The parser CAN parse the timezone and adjust the date accordingly. To parse this date: 20091021T121942+0200 I use this format: MMdd'T'HHmmssZZZ and it works fine. The only thing you need is to find the right timezone format string. Yours might be '-'MM'-'dd'T'HH':'mm':'ssZ Not sure if yo

Re: NSDate / NSXMLParser

2009-11-04 Thread Ingvar Nedrebo
The easiest way is to set the timezone on the formatter: [dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]]; On Nov 3, 2009, at 21:54, David Rowland wrote: Thanks to all for this useful discussion. I think I have solved my problem by taking the data from the parser as is an

Re: NSDate / NSXMLParser

2009-11-03 Thread Nick Zitzmann
On Nov 3, 2009, at 1:15 PM, David Rowland wrote: It still gets the hours right but tags the time zone as -0800 (Pacific). If you're basing that off of the description of the NSDate, then of course it does; NSDate objects have no knowledge of time zones, so the description shows the date

Re: NSDate / NSXMLParser

2009-11-03 Thread David Rowland
On Nov 3, 2009, at 10:04 AM, Chunk 1978 wrote: have you tried it on your device? Yes. The device and the Simulator behave the same way. On Tue, Nov 3, 2009 at 11:26 AM, David Rowland wrote: The SeismicXML sample code uses NSXMLParser to extract data from a file downloaded from the US

Re: NSDate / NSXMLParser

2009-11-03 Thread Kyle Sluder
On Tue, Nov 3, 2009 at 12:56 PM, David Rowland wrote: > But NSDate does have a knowledge of time zones. The reason I am doing this > it to do some arithmetic on the dates - like this, No, it does not. NSDate refers to a point in time ("seven seconds after the big bang"), not to how anyone might

Re: NSDate / NSXMLParser

2009-11-03 Thread David Rowland
Thanks to all for this useful discussion. I think I have solved my problem by taking the data from the parser as is and then applying a correction for my offset from GMT when I do my arithmetic. Like this, int offset = [[NSTimeZone localTimeZone] secondsFromGMT]; NSDate *today = [NSDate d

Re: NSDate / NSXMLParser

2009-11-03 Thread Nick Zitzmann
On Nov 3, 2009, at 1:56 PM, David Rowland wrote: In this code "today" gets created correctly. The display shows current Pacific hours and an offset of -0800. Of course it does. NSDate objects are always displayed as if they were in your local time zone; it just prints the time zone in the

Re: NSDate / NSXMLParser

2009-11-03 Thread David Rowland
On Nov 3, 2009, at 12:19 PM, Nick Zitzmann wrote: On Nov 3, 2009, at 1:15 PM, David Rowland wrote: It still gets the hours right but tags the time zone as -0800 (Pacific). If you're basing that off of the description of the NSDate, then of course it does; NSDate objects have no knowledg

Re: NSDate / NSXMLParser

2009-11-03 Thread David Rowland
On Nov 3, 2009, at 10:37 AM, Nick Zitzmann wrote: On Nov 3, 2009, at 9:26 AM, David Rowland wrote: 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? If you're using NSDateFormatter, you set the time zone by se

Re: NSDate / NSXMLParser

2009-11-03 Thread Nick Zitzmann
On Nov 3, 2009, at 9:26 AM, David Rowland wrote: 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? If you're using NSDateFormatter, you set the time zone by setting the formatter's calendar with an NSCalendar w

NSDate / NSXMLParser

2009-11-03 Thread David Rowland
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

Re: NSDate / NSXMLParser

2009-11-03 Thread Chunk 1978
have you tried it on your device? On Tue, Nov 3, 2009 at 11:26 AM, David Rowland 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' mea