How to format correctly according to the device configuration date and time when having a year, month, day, hour and minute?
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:
%1$td/%1$tm/%1$tY
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:
And in java class:
MovieDetailViewModel vm = new MovieDetailViewModel();
vm.setReleaseDate(new Date());