Alex Alex - 4 months ago 43
iOS Question

Swift 3 How to create Date for a specific date

In swift 2.3, I wrote a function that takes the date 6-01-16, converts it to NSDate, then utilizes that in a CKQuery. I'm not sure how to update this for Swift 3.

Here's my current code:

let formatter = DateFormatter()
formatter.dateFormat = "yyyymmdd"
let olddate = "20160601")

This isn't working, how should I change my syntax?


mm is the format for minutes; you mean MM for months. Your dateFormat should be: