This question already has answers here:
Closed 4 years ago.
I have a string which is coming from an API that I need to convert into a NSDate
but I'm uncertain which dateFormat to use for NSDateFormatter
.
let openedAt = "2015-06-30T12:34:00.000-04:00" // coming from API
let formatter = NSDateFormatter()
formatter.dateFormat = "yyyy-MM-dd..." // not sure what format to use here
if let date = formatter.dateFromString(openedAt) {
println(date)
} else {
println("NOPE!")
}