jaco-g
8/9/2017 - 10:26 AM

From https://stackoverflow.com/questions/41435857/convert-string-to-date-type-in-swift-3

    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "dd-mm-yyyy" //Your date format
    dateFormatter.timeZone = TimeZone(abbreviation: "GMT+0:00") //Current time zone
    let date = dateFormatter.date(from: "01-01-2017") //according to date format your date string
    print(date ?? "") //Convert String to Date