We would like to know, whether a user system locale is using 12-hours or 24-hours format?
There are many proposed solutions at How can I determine if iPhone is set for 12 hour or 24 hour time display?
One of the solutions are
let formatString = DateFormatter.dateFormat(fromTemplate: "j", options: 0, locale: Locale.current)!
let hasAMPM = formatString.contains("a")
However, to me, this is not a correct solution.
When I tested with de_DE
(German is using 24-hours), the returned string is HH 'Uhr'
- What is
Uhr
mean for? I guess it mean "clock" in German? - There are so many other locales and one of them might contain letter
a
.
Does anyone know, what is a correct way, to check whether user system locale is using 12-hours or 24-hours format?