You can use TIME_12_24 .
int time_format = 0; try { time_format = Settings.System.getInt(getContentResolver(), Settings.System.TIME_12_24); } catch (SettingNotFoundException e) { e.printStackTrace(); } Log.i(TAG,"Time format: "+time_format);
time_format will have 12 or 24 based on settings.
Make sure you add this permission to the manifest file.
<user-permission android:name="android.permission.WRITE_SETTINGS" />
EDIT:
You can also use DateFormat.is24HourFormat () . This does not require additional permission.
source share