Hello, there is a code:

sdf = new SimpleDateFormat("dd MMMMM",ruMonthFormatSymbols); mCalendarDateDisplay.setText(sdf.format(currentDate.getTime())); 

...

 private static DateFormatSymbols ruMonthFormatSymbols = new DateFormatSymbols() { @Override public String[] getMonths() { return new String[]{"Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"}; } }; 

I need to display the months in this form - with a capital letter and in the genitive case.

But in the end the text in

  mCalendarDateDisplay 

like this: "August 06", and I need "August 06".

Even if I explicitly write:

  sdf.setDateFormatSymbols(ruMonthFormatSymbols); 

SimpleDateFormat still ignores my instructions, how to fix it? Thank.

  • one
    try "LLLLL" instead of "MMMMM", maybe even ruMonthFormatSymbols will not be needed / - zRrr
  • @zRrr thank you very much. Unfortunately, the official documentation did not find a mention of this pattern, but it works. - Evgeniy Mh
  • I did not find him either, although six months ago he was there. API 24 integrated ICU4J and added andoid.icu.text.SimpleDateFormat , possibly related - zRrr

1 answer 1

In my case, you should use LLLLL, this code gave the desired result.

 SimpleDateFormat sdf=new SimpleDateFormat("dd LLLLL"); mEditText.setText(sdf.format(currentDate.getTime()));