This probably comes from a greatly underestimated assessment of the sheer complexity date times present.
That is one way to do it and there are others of course but ultimately it’s going to require the same three things:
a DateTime
a formatter
a String that tells the formatter how you want the date time represented which is almost a whole programming language unto itself given how many different ways there are to represent a date time world wide.