I want to know the current device time format, meaning 24 hour/ 12 hour format.
Please let me know how can I determine that.
Are there any API there to determine this?
I want to know the current device time format, meaning 24 hour/ 12 hour format.
Please let me know how can I determine that.
Are there any API there to determine this?
String value = android.provider.Settings.System.getString(context.getContentResolver(), android.provider.Settings.System.TIME_12_24);
Updated Answer, you should use this instead of the above, as above could give back a null value:
DateFormat.is24HourFormat(context)
This may help you....
The link of the answer source: https://developer.android.com/reference/android/text/format/DateFormat.html#is24HourFormat(android.content.Context)
I'm reporting something that seems an issue with Android 13: if the flag "use locale default" is on the device settings shows eg:
5:44 and the DateFormat.is24HourFormat(context) returns true
if I disable the option and leave the "Use 24 hour format" off it works properly.
Anyone has another solution to check if the clock on the status bar is 12 or 24h format?