标签:for objects end format bsp from cond date sse
日期转星期几
NSArray *arrWeek=[NSArray arrayWithObjects:@"周日", @"周一", @"周二", @"周三", @"周四", @"周五", @"周六", nil];
NSDate *date = [NSDate date];
NSCalendar *calendar = [ [NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *comps = [[NSDateComponents alloc] init];
NSInteger unitFlags = NSYearCalendarUnit |
NSMonthCalendarUnit |
NSDayCalendarUnit |
NSWeekdayCalendarUnit |
NSHourCalendarUnit |
NSMinuteCalendarUnit |
NSSecondCalendarUnit;
comps = [calendar components:unitFlags fromDate:date];
int week = [comps weekday];
int a = week - 1;
NSString *weekStr = [NSString stringWithFormat:@"%@",[arrWeek objectAtIndex:a]];
NSLog(@"啦啦啦 %@",weekStr);
标签:for objects end format bsp from cond date sse
原文地址:http://www.cnblogs.com/chenzq12/p/6213575.html