Use DateFormatter
let dateString = "2022-8-01T03:23:35.430+0000"
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSX"
let date = dateFormatter.date(from: dateString)
print(date) // Date object
/// Date to String
let format = "EEE, d MMM YYYY, h:ss a" // format you need as a String
let formatter = DateFormatter()
formatter.dateFormat = format
//By default AM/PM symbols are uppercased
formatter.amSymbol = "am"
formatter.pmSymbol = "pm"
let label: String = formatter.string(from: date!)
print(label) // "Mon, 1 Aug 2022, 3:23 pm"
0
solved iOS || Swift || how to convert date response String to expeced timestamp