Solution 1: DateUtil
val now = LocalDateTime.now()Ommit year if current year
// 4 Octoberval text = DateUtils.formatDateTime(context, now.toMillis()!!, 0)Show year if not current year
// 4 October 2018val now = LocalDateTime.now().minusYears(1)val text = DateUtils.formatDateTime(context, now.toMillis()!!, 0)Use abbreviation
// 4 Octval text = DateUtils.formatDateTime(context, now.toMillis()!!, DateUtils.FORMAT_ABBREV_ALL)Use abbreviation + Force show year
// 4 Oct 2019val text = DateUtils.formatDateTime(context, now.toMillis()!!, DateUtils.FORMAT_ABBREV_ALL or DateUtils.FORMAT_SHOW_YEAR)NOTE: Refer LocalDateTime.toMillis
Solution 2: DateTimeFormatter
val formatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM)// 4 Oct 2019val text = now.format(formatter)val formatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG)// 4 October 2019val text = now.format(formatter)val formatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT)// 04/10/2019val text = now.format(formatter)