```日历
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierChinese];// 农历
NSDate *currentDate = [NSDate date];
NSInteger weekIndexOfYear = [calendar ordinalityOfUnit:NSCalendarUnitWeekday
inUnit:NSCalendarUnitYear
forDate:currentDate];
NSLog(@"今天是今年的第%ld周",weekIndexOfYear);
NSInteger dayIndexOfMonth = [calendar ordinalityOfUnit:NSCalendarUnitDay
inUnit:NSCalendarUnitMonth
forDate:currentDate];
NSLog(@"今天是本月的第: %ld 天",dayIndexOfMonth);
```
网友评论