Date Conversion

Hi i’m new to swift just started learning


I want to convert string to date format then convert the date format to a string to pass it down to a label, was trying out several steps.


Steps Performed


let date = "2020-07-13T18:51:53.928+0000"

let formatter = DateFormatter()

let date2 = date)

formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"

let dateString = formatter.string(from: date2)

print("The Modified Date (dateString)")




The Modified Date nil




Powered by WPeMatico

You may also like...

Comments are closed.