I have spent way too much time (over an hour) on what I though would be a two minute task.
On the iPhone:
NSString * dateString = @"2010-09-11T00:00:00+01:00";
NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"YYYY-MM-dd'T'HH:mm:ssTZD"];
NSDate *date = [formatter dateFromString:dateString];
RESULT: date == nil
What am I missing!! (Besides my deadline)
Regards,
Ken
TZD isn’t a defined formatter per the unicode spec. The document you’ve linked to elsewhere was a suggestion someone made to W3C, for discussion only. The unicode standard followed by Apple is a finished standard, from a different body.
The closest thing to what you want would be ZZZ (ie, @”YYYY-MM-dd’T’HH:mm:ssZZZ”), but that doesn’t have a colon in the middle. So you’d need to use the string:
Rather than the one you currently have that ends in +01:00.
E.g. the following:
Logs a valid date object, of 2010-09-10 23:00:00 GMT.