myDateFormat.dateStyle = .medium
myDateFormat.timeStyle = .medium
print(myDateFormat.string(from: now))   // date/time, both medium format (e.g., Oct 5, 2021 at 11:45:20 AM)

myDateFormat.dateStyle = .long
myDateFormat.timeStyle = .none
print(myDateFormat.string(from: now))   // date with long format (e.g., October 5, 2021)

myDateFormat.dateStyle = .none
myDateFormat.timeStyle = .short
print(myDateFormat.string(from: now))   // time with short format (e.g., 11:45 AM)