I have this code that takes the name of the weekday with the values that are provided, today is August 10, 2014 and should return Sunday, but the code is returning Tuesday, why?
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
[dateComponents setWeekday:10];
[dateComponents setWeekdayOrdinal:1];
[dateComponents setYear:2014];
[dateComponents setMonth:8];
NSDate *tempDate = [gregorian dateFromComponents:dateComponents];
NSDateFormatter *format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"EEEE"];
NSString *retval = [format stringFromDate:tempDate];
NSLog(@"Today -> %@",retval);