My NSManagedObject has a property NSDate with format: 2012-03-27 14:43:22 +0000
. I want to sort my results by date, so I do:
NSSortDescriptor *sort= [[NSSortDescriptor alloc] initWithKey:@"createDate" ascending:NO selector:@selector(compare:)];
And I separate into sections using sectionNameKeyPath:
NSFetchedResultsController *theFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:appDelegate.managedObjectContext sectionNameKeyPath:@"createDate" cacheName:nil];
However, I want to sort by days, not by exact date. Currently, if I have two createDates of the same day but seconds apart, they are sorted into separate sections. I want to sort all objects with the same day into the same section. How would I do this?