Option #1 (Needs ADB Enabled)
Enable the 24-hour clock using the hidden Settings GUI:
- Start the hidden Settings activity using ADB:
adb shell am start -n com.android.settings/.Settings
- Check the box for:
Date & time → Use 24-hour format
- Swipe up from the bottom to go back to whatever was open before
Option #2 (Using TWRP)
If you already have TWRP installed:
- Enter recovery mode:
adb reboot recovery
Or, you can also do this without any of the prior changes to the device, by starting TWRP from an external image with
fastboot boot twrp.img as described above.
- Make sure /data partition is mounted (it should be, so a "failed [...] busy" message is in order):
adb shell mount /data
- Retrieve the settings database:
adb pull /data/data/com.android.providers.settings/databases/settings.db
adb pull /data/data/com.android.providers.settings/databases/settings.db-journal
- Download SQLite Tools for Windows, which includes the sqlite3.exe utility and run:
sqlite3 settings.db "UPDATE system SET value='24' WHERE name='time_12_24';"
- Note: the settings.db-journal file will be automatically deleted by SQLite, this is expected behavior. Also delete it from the device:
adb shell rm -f /data/data/com.android.providers.settings/databases/settings.db-journal
- Send the modified settings database back:
adb push settings.db /data/data/com.android.providers.settings/databases/
- Set the correct permissions and ownership metadata for the newly-uploaded file:
adb shell chown system.system /data/data/com.android.providers.settings/databases/settings.db
adb shell chmod 660 /data/data/com.android.providers.settings/databases/settings.db
- Reboot into system:
adb reboot
Other settings can be changed much the same way but this was the only one annoying me so far. If you prefer a graphical interface, the database file can also be edited with
SQLiteSpy or
SQLite Browser.