I have a Core Data entity which contains dates (e.g. 2011-03-30, 2011-06-30, 2011-09-30).
How would you recommend that I specify a NSPredicate to get the maximum date, which is below a specified date (2011-08-17), e.g. a query like date <= 2011-08-17 AND date = @max should return 2011-06-30 (which is the highest date but does not exceed the date given).
Could you please help me with the predicate?
Thank you!!
You could use the simple less-than-or-equal-to predicate, set the order to descending and configure the fetch to only return a single result.