This is not working for me. I have a value I'm getting from a database that's clearly a valid Date and I can print it out fine:
let datefromu = "\(PFUser.current()!.object(forKey:"original_date_route_started")!)"
print("I fetched \(datefromu)")
that prints: I fetched 2017-08-10 15:50:43 +0000.
I must add that if I look in the raw database it is written as so:
2017-08-10T15:50:43.436Z
so I think that output is already Parse's way of formatting the output from the date field?
Bottom line, when I want to populate a date variable I have (original_date_route_started: Date?) and convert that string to a date, I'm getting nil!:
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
self.original_date_route_started = formatter.date(from: datefromu)
datefromuis already aDateand not aString.formatter.string(from: datefromu)?original_date_route_started's type as aDatein the Schema (using the dashboard or the REST API), it will be converted to Date (swift) / NSDate (objc).