title: How do I fetch items that are n Days old using CoreData in Swift?
body: <p>I'm trying to use CoreData to find records that are greater than 2 days old, in order to do some processing. How can I use Swift to find records that are greater than two days old?</p>
  
  <p>This is my attempt:</p>
  
  <pre><code>class func findOldPics() {
      var appDel: AppDelegate = (UIApplication.sharedApplication().delegate as AppDelegate)
      var context: NSManagedObjectContext = appDel.managedObjectContext!
      var managedObject: NSManagedObject!
      var fetchRequest = NSFetchRequest(entityName: "Video")
      var date = NSDate(timeIntervalSinceNow: 3600)
  
      fetchRequest.predicate = NSPredicate(format: "date &lt;= %@", date)
  
      if let fetchResults = appDel.managedObjectContext!.executeFetchRequest(fetchRequest, error: nil) as? [NSManagedObject] {
          if fetchResults.count != 0{
              NSLog("***************** found film! updating status %@", fetchResults)
          } else {
              println("***************** no films found")
          } // else
      }
  } 
  </code></pre>