I'm using a NSFetchedResultsController
and a UITableViewController
to populate a UITableView from a CoreData database.
I have a NSDate
object saved into this Date attribute labeled "startTime". Then I'm trying to only pull todays's data by using a NSPredicate
that looks like this:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"startDate == %@",
todaysDate];
I'm getting zero results. I understand this because a NSDate
object just hold the number of seconds or milliseconds or whatever since Jan 1 1970 right? So comparing 1111111111111 and 1111111111112, while on the same day, are two distinct NSDate
objects that aren't equal.
So, how could the NSPredicate
be formatted so that it would do it? I'm going to guess its creating two NSDate
objects: one that is at 12am last night, and another for 12am tonight and compare startDate and see if its between these two NSDate
s.
I'm kind of new to NSPredicate
, so how could this be accomplished?