I get from server response in DateTime like this :
2019-04-24T16:25:02.557Z
and I would like only in String:
2019-04-23
How can I do this?
my code:
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ssZZZ"
let dateFormatterPrint = DateFormatter()
dateFormatterPrint.dateFormat = "MMM dd,yyyy"
let d = job.postedAt
if let date = dateFormatter.date(from: d) {
let k = dateFormatterPrint.string(from: date)
destinationVC.createdJob = k
} else {
print("There was an error decoding the string")
}