NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDate *now; NSDateComponents *comps = [[NSDateComponents alloc] init]; NSInteger unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSWeekdayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit; now=[NSDate date]; comps = [calendar components:unitFlags fromDate:now]; week = [comps weekday]; month = [comps month]; day = [comps day]; hour = [comps hour]; min = [comps minute]; sec = [comps second];
//Week:
1 --星期天
2--星期一
3--星期二
4--星期三
5--星期四
6--星期五
7--星期六