I have 2 dates in the following format:
August 6, 2012
I am using the following code to attempt to determine which date is later:
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"MMMM d, yyyy"];
NSString *today = [dateFormatter stringFromDate:[NSDate date]];
NSLog(@"%@", today);
NSDate *todayDate = [dateFormatter dateFromString:today];
NSLog(@"TodayDate: %@", todayDate);
for (Job *j in appDelegate.jobs){
if ([j.dueDate laterDate:todayDate]){
[jobsToDisplay addObject:j];
}
}
However this code does not work, it seems to return dates that are a day + 1 hour behind what they should be. Can anyone explain what I need to do here?
Thanks a lot,
Tysin