val text = localDateTime.format(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM))
DateTimeFormatter.ofLocalizedDateTime
DateTimeFormatter.ofLocalizedDate
DateTimeFormatter.ofLocalizedTime
FULL
:Tuesday, April 12, 1952 AD
or3:30:42pm PST
LONG
:January 12, 1952
MEDIUM
:Jan 12, 1952
SHORT
:12.13.52
or3:30pm
If your LocalDateTime
is in UTC
, you might want to convert it to local (system default) timezone before displaying the localized date string.
val localDateTime = uctLocalDateTime.atZone(ZoneOffset.UTC).withZoneSameInstant(ZoneId.systemDefault()).toLocalDateTime()