1 year ago

#167274

test-img

Alessandro Mulloni

DateTimeFormatter on Android outputs strange placeholders

The DateTimeFormatter class on Android 12 (Pixel 3a) outputs strange placeholders when formatting a local time.

Sample code:

    val sampleTime = LocalTime.of(13, 12, 45)
    val sampleFormatter = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT)
    Log.d("TEST", sampleFormatter.format(sampleTime))

Output on Huawei P20 (Android 10):

2022-02-11 15:20:33.917 10931-10931/..* D/TEST: 13:12

Output on Pixel 3a (Android 12):

2022-02-11 15:20:33.917 10931-10931/..* D/TEST: 13 ├minute: 12┤

I can't believe that nobody reported this bug so far. So I assume something is wrong with my app code or my project setup (or my build environment). I am using the latest stable Android Studio (Bumblebee 2021.1.1 Patch 1).

Anyone has a clue?

java

android

kotlin

datetimeformatter

0 Answers

Your Answer

Accepted video resources