I know there is a lot of threads on this subject and I have read them all.
In my particular case when tested on the iPhone 6.1 Simulator dateFromString is working flawlessly but returns null on iPhone 5.1 Simulator. I have also tested it on several devices with iOS6 and iOS5 getting to the same conclusion.
The format in 'input' being: 2013-02-15T18:00:00+03:00
I wrote the following code:
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
NSLocale *enUSPOSIXLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];
[dateFormatter setLocale:enUSPOSIXLocale];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss+zz:zz"];
NSDate *dateFromString = [[NSDate alloc] init];
dateFromString = [dateFormatter dateFromString:input];
[dateFormatter setDateFormat:@"EEE'. 'dd' 'MMM' 'yyyy', 'HH':'mm"];
NSString *stringFromDate = [dateFormatter stringFromDate:dateFromString];
return stringFromDate;
... to obtain in stringFromDate "Fri. 15 Feb 2013, 18:00" on iOS6 and "null" on iOS5 on both simulators and devices.
Please help me