Objective-C 中的组件年份总是返回 0001
我需要获取实际年份,只有年份,但是当我搜索结果时,我总是得到 0001。为什么呢?
使用该组件我可以获得日期和月份。
i need to get the actual year, only the year but when i search for the result, i get always 0001. why is it?
with the component i can get the day and the month.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,好吧,好吧...我已经解决了放置变量的问题:
unsigned int unitFlags = NSDayCalendarUnit | NSMonthCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit | NSYearCalendarUnit | NSHourCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit;
并将其分配给 NSDatecomponents 对象中的组件。
no ok ok... i've solved putting a variable:
unsigned int unitFlags = NSDayCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit;
and assigning it to the components in the NSDatecomponents object.