Tag Archives: null

Parsing date fields with NSDateFormatter ignoring locale

In many cases if the iOS device international settings is not set to US, you may have errors parsing text-based dates from e.g. RSS feeds.
The solution is to set the NSDateFormatter locale to en_US_POSIX.

NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];
[dateFormatter setLocale:locale];
[locale release];

by Luke Redpath on Stackoverflow.com