Change From Date To String Swift 5

[Solved] Change From Date To String Swift 5 | Swift - Code Explorer | yomemimo.com
Question : change from Date to String swift 5

Answered by : ghaith-alzin

let formatter = DateFormatter()
formatter.dateFormat = "HH:mm E, d MMM y"
print(formatter.string(from: today))

Source : https://www.hackingwithswift.com/example-code/system/how-to-convert-dates-and-times-to-a-string-using-dateformatter | Last Update : Mon, 07 Jun 21

Question : swift date to string

Answered by : davazo

let today = Date()
let formatter1 = DateFormatter()
formatter1.dateStyle = .short
print(formatter1.string(from: today))

Source : https://www.hackingwithswift.com/example-code/system/how-to-convert-dates-and-times-to-a-string-using-dateformatter | Last Update : Wed, 12 May 21

Answers related to change from Date to String swift 5

Code Explorer Popular Question For Swift