0
votes

A mouthful: when I pass the date "Tue, 15 Jan 2013 11:18:57 -0800" into an NSDateFormatter with the pattern string @"EEE, dd MMM yyyy HH:mm:ss ZZZ" when my Region Format is set to "United States", it works fine.

When I do exactly the same thing—with the exception that my Region Format is set to Germany—it can't parse it.

Any idea why this is so?

2

2 Answers

2
votes

The locale of the dateFormatter will be set to the currentLocale of the device, so you'll need to set it to the same region as the date you're trying to format.

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

Just a guess: If the region format is set to German names of days are translated to German, too. I would try to check if it is possible to parse "Die, 15 Jan 2013 11:18:57 -0800" with German region format.