I use this code to handle a date string coming from a json feed:
NSDateFormatter * formatter = [[NSDateFormatter alloc] init]; [formatter setDateStyle: NSDateFormatterLongStyle]; [formatter setFormatterBehavior: NSDateFormatterBehavior10_4]; [formatter setDateFormat: @"EEE, dd MMM yyyy HH:mm:ss +0000"];
so if i call
NSDate *date = [formatter dateFromString: @"Tue, 08 Sep 2009 19:21:27 +0000"];
I return a useful date if my regional format is the United States or the United Kingdom, but if I put it in Germany, it will return to zero. I understand that there are some differences in behavior in different locales, but if I define the format, should this not fix any inconsistencies?
source share