kevin.cianfarini
01/17/2023, 4:42 PMLocalDateTime
to javas datetime utilities, how would I format the full date and time? Right now the value
LocalDateTime(
year = 2023,
monthNumber = 1,
dayOfMonth = 17,
hour = 10,
minute = 30
)
Gets formatted to Tuesday, January 17, 2023
with the following invocation:
DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL)
.withLocale(javaLocale)
.format(dateTime.toJavaLocalDateTime())
I would expect this to format to something like Tuesday, January 17, 2023 10:30 AM
.hfhbd
01/17/2023, 4:45 PMtoJavaLocalDateTime()
kevin.cianfarini
01/17/2023, 4:45 PMLocalDate
and LocalTime
.DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL)
.withLocale(javaLocale)
.format(dateTime.toJavaLocalDateTime())
DateTimeFormatter.ofLocalizedDateTime
. That’s probably what I need.DateTimeFormatter.ofLocalizedDateTime(
FormatStyle.FULL,
FormatStyle.SHORT
).withLocale(javaLocale).format(dateTime.toJavaLocalDateTime())
which yields
Tuesday, January 17, 2023, 10:30 AM
FULL
format style on kotlinx.LocalDateTime
for the time component because local date times don’t have timezone info embedded.