Back to 2016, When I want to customize the format (not according to the device configuration, as you ask...) I usually use the string resource file:
in strings.xml:
<string name="myDateFormat"><xliff:g id="myDateFormat">%1$td/%1$tm/%1$tY</xliff:g></string>
In Activity:
Log.d(TAG, "my custom date format: "+getString(R.string.myDateFormat, new Date()));
This is also useful with the release of the new Date Binding Library.
So I can have something like this in layout file:
<TextView
android:id="@+id/text_release_date"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:padding="2dp"
android:text="@{@string/myDateFormat(vm.releaseDate)}"
tools:text="0000"
/>
And in java class:
MovieDetailViewModel vm = new MovieDetailViewModel();
vm.setReleaseDate(new Date());