NSDateComponents Weekday 总是从星期日开始,也就是星期天是 1 星期一是 2 ……星期六是 7
[NSCalendar setFirstWeekday:2],改变的是类NSCalendar的week排列顺序,跟NSDateComponents的weekday没有关系,它还是以星期天是1开始,改变的只是NSCalendar的实例,该实例的weekday改为了周一是1开始。
//返回周几的问题
- (NSString *)datestr
{
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
NSArray *weekdayAry = [NSArray arrayWithObjects:@"周日", @"周一", @"周二", @"周三", @"周四", @"周五", @"周六", nil];
[dateFormat setShortWeekdaySymbols:weekdayAry];
[dateFormat setDateFormat:@"yyyy年eee"];
NSDate *date = [NSDate date];
NSString *srting = [dateFormat stringFromDate:date];
return srting;
}