0

I have a function like given below, and the date is displaying nil as in the screenshot, But while printing it shows the value. Did I miss something?

let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
dateFormatter.timeZone = NSTimeZone(name: "UTC")! as TimeZone
dateFormatter.locale = Locale.init(identifier: "en_US_POSIX")
let date = dateFormatter.date(from: "2020-07-27 04:01:46")

enter image description here enter image description here

vipintklm
  • 9
  • 4

0 Answers0