Couldn't translate Date to spanish with Locale(“es_ES”)

前端 未结 5 840
别跟我提以往
别跟我提以往 2020-12-05 23:06

I\'m trying to do a simple date format, it does work great, it\'s very easy, but the problem is the language. I used the locale \"es_ES\" to get \"Miércoles\" instead of \"W

5条回答
  •  误落风尘
    2020-12-05 23:16

    Java 8

    LocalDate today = LocalDate.now();
    String day = today.getDayOfWeek().getDisplayName(TextStyle.FULL, new Locale("es","ES")));
    

    Also works for month.

提交回复
热议问题