NSCalendar *calendar = [[NSCalendaralloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
NSDate *now = [NSDate date];
NSDateComponents *comps = [[NSDateComponentsalloc] init];
NSInteger unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitWeekday |
NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
calendar.locale = [[NSLocalealloc] initWithLocaleIdentifier:@"zh_CN"];
comps = [calendar components:unitFlags fromDate:now];
long week = [comps weekday];
NSLog(@"week=============%ld",week);
网友评论