iOS 6 NSDateFormatter stringFromDate: empty day of week
dayofweek, ios6, iphone, nsdateformatter, objective-c
Solution
That actually looks like a bug in `NSDateFormatter` on iOS 6. However, it seems that the bug occurs only if you explicitly set
[formatter setDoesRelativeDateFormatting:NO];
If you omit that line (and `NO` is the default anyway) then the result is OK (at least when I tested it).
Remark: I assume that `setDoesRelativeDateFormatting` is only meant to be used in connection with `setDateStyle:`, but that is pure guessing.
Problem
I'm having an issue with obtaining the full name for the day of week in iOS 6 NSDate object (in iOS 7 works fine). I've searched stackoverflow for similar issues but I didn't find what I was looking for. My test case is: ``` formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"EEEE"]; [formatter setDoesRelativeDateFormatting:NO]; NSDate *testDate = [NSDate dateWithTimeIntervalSince1970:1384551041.389218]; NSLog(@"%@",[formatter stringFromDate:testDate]); ``` The expected output is `Friday` (localized to your device region format and on a gregorian calendar), it works on iOS 7 but on iOS 6 it returns an empty description. I've tested in actual devices with the same region format set. As far as I know, iOS 6 uses tr35-25 formatting according to this documentation, and the `EEEE` specifies full name day of week in that format. Am I missing something?