I am trying to produce a date from a string with the following:
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"MMMM dd, yyyy HH:mm:ss"];
NSLog(@"ENDINGDATE: %@", [closure objectForKey:@"ENDINGDATE"]);
NSDate *tempDate = [dateFormatter dateFromString:[closure objectForKey:@"ENDINGDATE"]];
The ENDINGDATE NSLog produces the following:
ENDINGDATE: April, 21 2011 20:00:00
Everything seems to be fine, so I am stumped as to why tempDate is being set to nil. Any ideas? Thanks!
The
,is misplaced. It should be afterMMMM. So the format should have defined asMMMM, dd yyyy HH:mm:ss.