Is there a way to drop the comma and space elements when using Date.FormatStyle?

31 views Asked by At

If you

let s = d!.formatted(
    Date.FormatStyle()
        .year(.twoDigits)
        .month(.twoDigits)
        .day(.twoDigits)
        .hour(.defaultDigits(amPM: .narrow))
        .minute(.twoDigits))
print(s)

the result is like ...

11/03/23, 11:30 a
10/07/23, 6:00 p

naturally I need a slightly different format ...

11/20/23 11:20a
10/17/23 2:00p

Does FormatStyle have the ability to alter the comma and the day period space?

0

There are 0 answers