iOS 获取当前时间 年、月、日、周几
NSDate * nowDate = [NSDate new];
NSCalendar *calendar = [NSCalendar currentCalendar];
NSUInteger unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSWeekdayCalendarUnit;
NSArray * weekTitleArray = @[@"周日",@"周一",@"周二",@"周三",@"周四",@"周五",@"周六"];
NSArray * monthTitleArray = @[@"一月",@"二月",@"三月",@"四月",@"五月",@"六月",@"七月",@"八月",@"九月",@"十月",@"十一月",@"十二月"];
NSDateComponents *dateComponent = [calendar components:unitFlags fromDate:nowDate];
headerView.monthLabel.text = monthTitleArray[[dateComponent month] - 1];
headerView.weekLabel.text = weekTitleArray[[dateComponent weekday] - 1];
NSInteger day = [dateComponent day];
headerView.dateLabel.text = (day < 10 ? [NSString stringWithFormat:@"0%ld",day] : [NSString stringWithFormat:@"%ld",day]);