Is is possible to format a date like 25 May MON
(not 25 May Mon
)? Or do I have to format the date twice ("d MMM"
and "EEE"
), then call uppercase
for the second string and then join them?
Asked
Active
Viewed 112 times
1
-
1Personally I would use [`DateTimeFormatterBuilder.appendText(TemporalField, Map
)`](https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/time/format/DateTimeFormatterBuilder.html#appendText(java.time.temporal.TemporalField,java.util.Map)) to build a formatter that would format the day of week abbreviation in all uppercase. But yes, another option is to have two `DateTimeFormatter`s, uppercase the string from one of them and concatenate the results. – Ole V.V. Apr 20 '23 at 18:38 -
1See [my answer to a similar question here](https://stackoverflow.com/a/51240496/5772882). – Ole V.V. Apr 20 '23 at 18:47
-
4Yet an alternative would be `String.format(Locale.ENGLISH, "%te %
– Ole V.V. Apr 20 '23 at 19:06 -
Is all-uppercase the norm in the particular culture in which you are interested? If so, say so. Then we might be able to get your desired result via `Locale` class. – Basil Bourque Apr 27 '23 at 19:02