let now = Date()
let shortStyle = DateFormatter.localizedString(from: now,
dateStyle: DateFormatter.Style.short,
timeStyle: DateFormatter.Style.short)
//shortStyle is '6/29/23, 8:48 AM'
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .medium
dateFormatter.timeStyle = .none
dateFormatter.locale = Locale(identifier: "ru-Ru")
let ruStyle = dateFormatter.string(from: now)
//ruStyle is the same date in the ru-Ru locale
dateFormatter.dateFormat = "yyyy-MM-dd"
let customStyle = dateFormatter.string(from: now)
//customStyle is '2023-06-29'
print("shortStyle = '\(shortStyle)'")
print("ruStyle = '\(ruStyle)'")
print("customStyle = '\(customStyle)'")