I have an NSDictionary
that holds a date like this:
"2015-05-23 21:04:11 +0000"
and I'm trying to parse it like:
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss z"];
NSDate *date = [dateFormat dateFromString:[item valueForKey:@"enddata"]];
I also tried changing the last line to:
NSDate *date = [dateFormat dateFromString:[[item valueForKey:@"enddata"] stringValue]];
but my error is always the same:
[__NSDate length]: unrecognized selector sent to instance 0x78ec0170
I've seen posts like this, or this, or this, and many more. I've tried with different formats such as:
- @"yyyy-MM-dd HH:mm:ss z"
- @"yyyy-MM-dd HH:mm:ss zzzz"
- @"yyyy-MM-dd HH:mm:ss Z"
- @"yyyy-MM-dd HH:mm:ss +zzzz"
- @"yyyy-MM-dd HH:mm:ss z"
- @"yyyy-MM-dd'T'HH:mm:ss'Z'"
- @"yyyy-MM-dd hh:mm:ss a"
- @"yyyy-MM-dd HH:mm:ss a"
- @"yyyy-MM-dd HH:mm:ss zzz"
- @"yyyy-MM-dd hh:mm:ss zzzz"
but still getting the same SIGABRT
Does anyone have a clue what's wrong?