Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要得到实际的年份,只有年份,但是当我搜索结果时,我总是得到 0001。为什么会这样?
使用该组件,我可以获得日期和月份。
不好吧好吧...我已经解决了放置一个变量的问题:
unsigned int unitFlags = NSDayCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit;
并将其分配给 NSDatecomponents 对象中的组件。