How to determine programmatically if current locale uses AM/PM or 24h format for time?

StackOverflow https://stackoverflow.com/questions/14447610

  •  17-01-2022
  •  | 
  •  

문제

I have a 24h formatted time string like 13:30 which I must translate into a 12h time format string when the user's locale uses AM/PM. How can I detect that reliably?

도움이 되었습니까?

해결책

There's a few methods. See my question here Detect iPhone 24-Hour time setting Basically you set a time and check the string for am or pm

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top