I am trying to parse the following NSString to an NSDate object:
“Sat, 21 Jan 2012 13:06:00 +0100”
I know that I need the following lines of code to do this:
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"EEE, MMM dd yyyy HH:mm:ss GMT"];
NSDate *dateObject = [dateFormat dateFromString:dateString];
But since dateObject always has the value nil, I assume that the expression inside the dateFormatter is not correct.
Does anyone have a suggestion for the right formatter statement?
Have already tried a lot of options, but none of them seems to work.
Thanks a lot.
Your date format is wrong. it should be:
for
You’ve accidentally exchanged “dd” and “MMM”.