I'm trying to use NSDateFormatter
to get the NSDate from String.
I've got the date in this format "Sat, 01 Aug 2015 15:00:12 GMT"
and I'm setting date format this way:
dateFormatter.dateFormat = "EEE, dd MMM yyyy HH:mm:ss Z"
but dateFormatter.dateFromString("Sat, 01 Aug 2015 15:00:12 GMT")
returns nil. Why is that happening and how to fix it?
EDIT:
var date:NSDate?
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "EEE, dd MMM yyyy HH:mm:ss z"
date = dateFormatter.dateFromString("Sat, 01 Aug 2015 15:00:12 GMT")