I have a date like so:
2014-10-28T00:00:00
and when I try to format it, it returns nil, this is what I tried:
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
let closingDate = formatter.date(from: item["closingDate"] as! String)
Why is it returning nil? and How can I fix it?
Drop the millisecond and the timezone from your format:
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss"