I have an NSDateCategory that is misbehaving. I am setting the year, month day but its result is completely different :
variables :
year = 2012
month = 10
day = 1
+ (NSDate *)dateWithYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day
{
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *components = [[NSDateComponents alloc] init];
[components setYear:year];
[components setMonth:month];
[components setDay:day];
NSDate *result = [calendar dateFromComponents:components];
return result;
}
NSLog output
result = 2012-09-30 23:00:00 +0000
Add this line
Hope this will work for you