Closed
Description
It is not included in the documentation so we would like to ask if Kotlinx Datetime has java.time.format.DateTimeFormatter
equivalent for formatting?
Here are the following usage we had with the Java DateTimeFormatter
val formattedDate: String
get() = LocalDate.parse(date, DateTimeFormatter.ISO_LOCAL_DATE_TIME).format(
DateTimeFormatter.ofPattern("MMM. dd, yyyy")
)
val formattedTime: String = Instant.ofEpochMilli(time).atZone(ZoneId.systemDefault())
.toLocalDate().format(DateTimeFormatter.ofPattern("MM-dd-yyyy"))
LocalDateTime.parse(
lowDate,
DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'")
)
Currently using coreLibraryDesugaringEnabled
for backward compatibility.