Sara Canducci Sara Canducci - 1 year ago 80
Swift Question

From String to NSDate in Swift

I've got a

containing a
in this format:
Thu, 04 Sep 2014 10:50:12 +0000

Do you know how can I convert it to:

of course, using Swift

Answer Source

If the above doesn't work, this should do the trick:

let formatter = DateFormatter()
formatter.locale = Locale(identifier: "US_en")
formatter.dateFormat = "E, dd MMM yyyy HH:mm:ss Z"
let date = "Thu, 04 Sep 2014 10:50:12 +0000")
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download