How to use the date format that was configured by default in the settings?

As you probably know, you can set the date format in the settings of the Android device.

In the code, do we use this format to display the date?

+6
android date-format locale
source share
2 answers

Try android.text.format.DateFormat , especially getDateFormatOrder() to get your preferred user date format.

+5
source share

You can get both the date format and the time format as follows:

 DateFormat timeFormat; DateFormat dateFormat; dateFormat = android.text.format.DateFormat.getDateFormat(context); timeFormat = android.text.format.DateFormat.getTimeFormat(context); 
0
source share

All Articles