I have problem using the NSDateFormatter to parse a date string. I have implemented the method method below as an NSDate category. The input is the following date string Thu, 22 Dec 2011 16:03:39 +0100 and using the following pattern for parsing EEE, dd MMM yyyy HH:mm:ss ZZZ
The problem is that the method returns nil
+(NSDate*) dateFromString:(NSString*)dateString pattern:(NSString*)pattern
{
NSDateFormatter *dateParser = [[NSDateFormatter alloc] init];
[dateParser setDateFormat:pattern];
NSDate *parsedDate = [dateParser dateFromString:dateString];
return parsedDate;
}
I have looked on Stackoverflow and elsewhere on the Internet, but not found a solution to this problem.
[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]
– Fabian Kreiser