Reputation: 9979
I need weekday symbol in MO TU WE TH FR SA SU
I am using setDateFormat:@"EEEEE"];
with shortWeekdaySymbols
But it only return Sun Mon etc. Let me know if it is possible ?
Upvotes: 1
Views: 1194
Reputation: 2918
As rmaddy has mentioned, you can use six E format. That will give you Mo, Tu, We etc. But if you want them in captitals specifically (MO, TU, WE, etc), you can set the veryShortWeekdaySymbols
property of the NSDateFormatter
object and use the same format mentioned in the question. You can use any Weekday Symbol you wish. As follows:
NSDate *date = [NSDate date];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.veryShortWeekdaySymbols = @[@"SU", @"MO", @"TU", @"WE", @"TH", @"FR", @"SA"];
formatter.dateFormat = @"EEEEE";
NSLog(@"%@", [formatter stringFromDate:date]);
Upvotes: 2
Reputation: 318794
According to the Unicode specification you should be able to use the EEEEEE
(six E) format to get a two-letter weekday symbol.
Upvotes: 4