Core Data Predicate Filter By Today's Date
I had issues with this and I haven't found a proper answer on SO so I'll leave a small tutorial here. The goal is to filter fetched objects by today's date. Note: It's Swift 3 compatible. Lawrence413 You can't simply use to compare your date to today's date: let today = Date() let datePredicate = NSPredicate(format: "%K == %@", #keyPath(ModelType.date), today) It will show you nothing since it's unlikely that your date is the EXACT comparison date (it includes seconds & milliseconds too) The solution is this: // Get the current calendar with local time zone var calendar = Calendar.current