I want to find out the date of the first week of a mouth in a year:
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *components = [[NSDateComponents alloc] init];
[components setYear:2013];
[components setMonth:1];
[components setWeekOfMonth:1];
[components setWeekday:1];
NSDate *newDate = [calendar dateFromComponents:components];
NSLog(@"%@",newDate);
What I get is:
2012-12-29 23:00:00 +0000
And when I compare to my mac calendar what I need to get is:
2012-12-31 23:00:00 +0000
Any suggestions?