How do I calculate the number of days in this year in Objective C

前端 未结 12 2119
旧巷少年郎
旧巷少年郎 2020-12-06 03:07

How can i calculate the number of days in a year for any calendar, not just gregorian. I have tried this

NSUInteger *days = [[NSCalendar currentCalendar] range

12条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-06 04:08

    [[NSCalendar currentCalendar] ordinalityOfUnit:NSYearCalendarUnit
                                            inUnit:NSEraCalendarUnit forDate:date];
    

提交回复
热议问题