-1

I have to validate, questions on the basis of the odd or even week. If there is odd week then I will have to show different questions from even week. I am getting the questions from server from a "GET" method.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • Possible duplicate of [Get the Week Number in iOS SDK](http://stackoverflow.com/questions/17587697/get-the-week-number-in-ios-sdk) – ZeMoon Mar 03 '16 at 13:38

1 Answers1

1

try this

NSCalendar *calendar = [NSCalendar currentCalendar];
 NSDateComponents *dateComponent = [calendar components:(NSWeekOfYearCalendarUnit) fromDate:[NSDate date]];
 NSLog(@"%lu",(long unsigned)dateComponent.weekOfYear);

bool isEven = (dateComponent.weekOfYear % 2) == 0
techloverr
  • 2,597
  • 1
  • 16
  • 28