Nav*_*rma 0 objective-c nsdate nsdateformatter ios
我想知道NSDate当天的一周.
示例: - 假设今天是2016年10月10日,这里周数是我使用的第3个
NSInteger week = [_calendar component:NSCalendarUnitWeekOfMonth fromDate:date];
现在我想知道本周的当天数,这是10月10日的第2天.
它将获取您的日期编号,即2.每周的天数始终相同.(1-7)
//Assuming your calendar is initiated like this
NSCalendar *_calendar = [NSCalendar currentCalendar];
//Fetch the day number
NSInteger day = [_calendar component:NSCalendarUnitWeekday fromDate:date];
在此处了解NSCalendar更多详情
| 归档时间: | 
 | 
| 查看次数: | 1027 次 | 
| 最近记录: |