How would I convert an NSString
like \"01/02/10\" (meaning 1st February 2010) into an NSDate
? And how could I turn the NSDat
String To Date
var dateFormatter = DateFormatter()
dateFormatter.format = "dd/MM/yyyy"
var dateFromString: Date? = dateFormatter.date(from: dateString) //pass string here
Date To String
var dateFormatter = DateFormatter()
dateFormatter.dateFormat = "dd-MM-yyyy"
let newDate = dateFormatter.string(from: date) //pass Date here