title: How to convert a parse date object to a string?
body: <p><em>beginner alert</em></p>
  
  <p>I'm trying to query for a date from PFUser and then format it to NSDate so it is more useful. The trouble begins when I try to convert the object to a NSString so I can format it with NSDateFormatter()</p>
  
  <pre><code>    var user = PFUser.query()
      user.whereKey("username", equalTo: PFUser.currentUser().username)
      user.findObjectsInBackgroundWithBlock { (objects, error) -&gt; Void in
          if error == nil {
              for object in objects {
                  var lastActive = object["lastActive"]
                  if lastActive != nil {   
                  let newLastActive = lastActive as String //problem starts here!!
                  let dateFormatter = NSDateFormatter()
                  dateFormatter.dateFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.SSS'Z'"
                  let date = dateFormatter.dateFromString(newLastActive)
                  println("new date \(date)")
                  }
  
              }
          }
      }
  </code></pre>
  
  <p>What is the correct way of doing this? Also, if I don't specify the variable type as AnyObject, it keeps coming out as a optional. How do I get rid of the optional while converting it to String?</p>
  
  <p>edit: the object "lastActive" is a date set by parse cloud, not a string.</p>