I am working on an application in iOS where I have an NSDateFormatter object as follows:
NSDate *today = [NSDate date];
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"EEE, MMM. dd"];
NSString *dateString = [dateFormat stringFromDate:today];
NSLog(@"%@", dateString);
My output is: Tue, Dec. 10 and I would like to display: TUE, Dec. 10 instead.
My problem though is that the day of the week has only the first letter capitalized, and not the entire day (i.e. I am getting "Tue", and I would like to display "TUE"). The formatting of the month is fine (i.e. "Dec" I am happy with).
I have checked the specs on date formatting and unfortunately there is no conventional way of doing this using the NSDateFormatter class. Is there a way around this to still capitalize all of the abbreviated letters in the day of the week only without touching the month?