Converting a NSDate to a String and String to a NSDate
Converting a NSDate to a String and back again is easy with a few lines of code. NSDate to String let date = NSDate() // Get Todays Date let dateFormatter = DateFormatter() dateFormatter.dateFormat = “dd-MM-yyyy” let stringDate: String = dateFormatter.string(from: date as Date) print(stringDate) String to NSDate var dateString = “30-03-2016” var dateFormatter = DateFormatter() […]