Try this:
val date = Calendar.getInstance().time
val formatter = SimpleDateFormat.getDateTimeInstance() //or use getDateInstance()
val formatedDate = formatter.format(date)
You can use your own pattern as well, e.g.
val sdf = SimpleDateFormat("yyyy.MM.dd")
// 2020.02.02
To get local formatting use getDateInstance()
, getDateTimeInstance()
, or getTimeInstance()
, or use new SimpleDateFormat(String template, Locale locale)
with for example Locale.US for ASCII dates.
The first three options require API level 29.