wbk727
wbk727

Reputation: 8408

Java 8: How to parse DayOfWeek with locale set by device

Why is it that whenever I set a DayOfWeek for my TextView the output always appears in capital letters? Also, the day never changes when the language of my device is changed. How can it be set to change based on the device's current locale?

    myTv.text = DayOfWeek.MONDAY.toString()

Output

MONDAY

Upvotes: 2

Views: 128

Answers (1)

Reimeus
Reimeus

Reputation: 159844

You could do (replace Locale accordingly...)

String day = DayOfWeek.MONDAY.getDisplayName(TextStyle.FULL, Locale.getDefault());

Upvotes: 8

Related Questions