| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
bx52
9年前发布

iOS开发 根据日期计算是星期几

 NSDateComponents *_comps = [[NSDateComponents alloc] init];      [_comps setDay:23];      [_comps setMonth:3];      [_comps setYear:2014];      NSCalendar *gregorian = [[NSCalendar alloc]                               initWithCalendarIdentifier:NSGregorianCalendar];      NSDate *_date = [gregorian dateFromComponents:_comps];      NSDateComponents *weekdayComponents =      [gregorian components:NSWeekdayCalendarUnit fromDate:_date];      int _weekday = [weekdayComponents weekday];      NSLog(@"_weekday::%d",_weekday);