NSCalendar没有从组件返回正确的日期

时间:2014-07-24 21:58:27

标签: nscalendar nsdatecomponents

NSCalendar *currentCalendar = [NSCalendar currentCalendar];

NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
[dateComponents setWeekOfYear:30];
[dateComponents setYear:2014];

NSDate *dayOfTheGivenWeek = [currentCalendar dateFromComponents:dateComponents];

dayOftheGivenWeek实际上是2014-01-01 00:00:00 CST,尽管我将weekOfYear设置为30.任何想法都是为什么?

0 个答案:

没有答案