Creating NSDate from NSDateComponents off by one day
I'm trying to set a particular date for a unit test: NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDateComponents *components = [[[NSDateComponents alloc] init] autorelease]; [components setCalendar:calendar]; [components setYear:2011]; [components setMonth:5]; [components setDay:12]; [components setHour:1]; [components setMinute:0]; [components setSecond:0]; NSDate *date = [calendar dateFromComponents:components]; NSLog(@"Date I tried to set: %@", date); However, this prints out "Date I tried to set: 2011-05-11 17:00:00 +0000." The date seems