Hi,
I am trying to convert a Unix Timestamp inside my Codable struct but it decodes it a little bit wrong.
Do you have a suggestion for me ?
UNIX String: 1680291600
Right Date: Fri Mar 31 2023 19:40:00 GMT+0000
My Result wrong result: 20/01/70 11:44:51
I think I need a ISO8601DateFormatter() but how can I run it ?
struct Times: Codable {
let schedOut: Stringenum CodingKeys: String, CodingKey { case schedOut = "sched_out" } /* let dateFormatter : DateFormatter = { let formatter = DateFormatter() formatter.dateFormat = "dd/MM/yy HH:mm:ss" return formatter }() var dateString : String { let timeInterval = TimeInterval(schedOut)! let date = Date(timeIntervalSince1970: timeInterval / 1000) return dateFormatter.string(from:date) }