I currently am migrating a piece of software from Java 11 to Java 17 and noticed that DateTimeFormatter has changed its behaviour when formatting time that contains the AM/PM marker. Earlier, that marker would have been localised (e.g. vorm. for AM in German) and now, it stays AM. This is not a locale-specific issue, because I already have tried this with other locales. The pattern that is being tried here is HH:mm:ss a, where a is the place holder of the marker. How can the previous behaviour be restored?
The DateTimeFormatter is being called using the ofPattern method as follows:
ofPattern("HH:mm:ss a", Locale.GERMANY).format(now).
The variable now is a LocalDateTime object.