I need date to be convert from dd MMMM YYYY to dd-mm-yyyy.
e.g. : (01 August 2021) -> 01-09-2021
let dateFormatter = DateFormatter()
dateFormatter.locale = Locale(identifier: "en_US_POSIX")
dateFormatter.dateFormat = "dd-MM-yyyy"
print( dateFormatter.date(from:response.data?[0].mbStartDate ?? ""))
The output is nil.
I've make sure that response data value is exist
How to convert it ?
And How to change "01 August 2021" to other languange? My case is change it to indonesian. So it becomes "01 Agustus 2021". How to do this too?
Thanks before