Retrieving NSDate from NSString

Posted by Olivier de Jonge on Stack Overflow See other posts from Stack Overflow or by Olivier de Jonge
Published on 2010-03-14T04:44:54Z Indexed on 2010/03/14 4:55 UTC
Read the original article Hit count: 297

Filed under:
|
|
|

I have an iPhone app. that is receiving data with IRFC 3339 timestamp format (e.g. @"2010-01-29T11:30:00.000+01:00"), as in GData. I want to convert the data to an NSDate

NSDateFormatter *inputFormatter = [[[NSDateFormatter alloc] init] autorelease];
[inputFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSS"];
[currentEntry setStartTime:[inputFormatter dateFromString: ][currentEntry startTimeString]]];

But I'm missing out how to convert the last part of the string @"2010-01-29T11:30:00.000+01:00": the time offset. Anyone knows what I have to add to this String to take the time offset in account too?

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about objective-c