title: Date picker age verification IOS Swift
body: <p>Hello i am trying to make a date picker for age restriction on minimum 18 years of age, by picking date of birth in the datepicker then i want my code to calculate if the person is 18 years or older to be allowed to proceed to next step.</p>
  
  <p>My code so far looks like this:</p>
  
  <pre><code>@IBAction func veryfyButton(sender: AnyObject) {
  
      var myDateConverterObject = NSDateFormatter()
  
      let formatter = NSDateFormatter()
  
      let dateAsDate = datePicker.date
  
      let dateAsNow = NSDate()
  
      let interval = dateAsNow.timeIntervalSinceDate(dateAsDate)
  
      let convertedDate = myDateConverterObject.stringFromDate(dateAsNow)
  
  
      print(interval / 1000)
  
  
  
  }
  </code></pre>