android default time format modification method

  • 2020-05-07 20:23:54
  • OfStack

In the use of android, when the default time format is modified, we are always at a loss what to do. This article will provide a solution to this problem, and those who need to know can refer to it

When the language is English, the default time format is mm/DD/yyyy. Could you please tell me how to change the default time format to DD/mm/yyyy?

1. Modify the file
alps\frameworks\base\packages\SettingsProvider\res\values\defaults.xml
Add the code < string name="time_12_24" translatable="false" > 24 < /string >
The red flag indicates 24-hour system, which can also be changed to 12 (12-hour system).

2. Modify the document alps\frameworks\base\packages\SettingsProvider\src\com\ providers\settings\ DatabaseHelper.java
Find the function loadSystemSettings () and add the following statement to the function:
loadStringSetting(stmt, Settings.System.TIME_12_24, R.string.time_12_24);

Related articles: