i am trying to parse string date which is coming from an API to Date().
the date string is: 31-07-2023 12:44 (EEST)
My code:
let formatter = DateFormatter()
formatter.dateFormat = "dd-MM-yyyy hh:mm (zzzz)" // "yyyy-MM-dd h:mm a"
if let ptdate = formatter.date(from: prayer.getString("time")) {
// Not working!
}
i believe there is something missing in date format i am using which is dd-MM-yyyy hh:mm zzzz, i am not sure what it is, since i've spent hours googling date formats.
I did it like this (no date formatter needed):