I have this format and obviously when I turn on the clock at 12 o'clock, it returns a
null , if I put it at 24h, I format the date well.
How can I solve this? ! Update: For 12h I try this
let dateFormatter1 = DateFormatter() dateFormatter1.dateFormat = "yyyy-MM-dd hh:mm:ss" dateFormatter1.timeZone = NSTimeZone(abbreviation: "UTC") as TimeZone! print(dateFormatter1.date(from: "2017-01-1 14:55:08")) //if you want current date
And this returns a null