开发者

How can I determine whether a device is using 12 or 24-hour time format?

开发者 https://www.devze.com 2023-03-19 22:15 出处:网络
I want to know the current device time format. means 24 hour/ 12 hour format . Plz let me know how can I determine that.

I want to know the current device time format.

means 24 hour/ 12 hour format .

Plz let me know how can I determine that.

Are there any API there to determine this.

开发者_如何学C

thanks.


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号