Number of day of current year in iOS
问题 I want to find number of day today is in current year. e.g, if today is Mar15, 2012 I should get 75(31 + 29 + 15). Or we can simply say that number of days between today and Jan01 of current year. 回答1: Use the ordinalityOfUnit method of the NSCalendar to get the day number in the year - specify the NSDayCalendarUnit inUnit:NSYearCalendarUnit NSCalendar *currentCalendar = [NSCalendar currentCalendar]; NSDate *today = [NSDate date]; NSInteger dc = [currentCalendar ordinalityOfUnit