3

I am trying to display text for my date using DateUtils.formatDateRange() method with below option:

DateTime time = new DateTime().withYear(year).withMonthOfYear(month).withTimeAtStartOfDay();
Locale locale = new Locale("pl");
Formatter formatter = new Formatter(locale);

String title = DateUtils.formatDateRange(getContext(), formatter, time.getMillis(), time.getMillis(),
                    DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NO_MONTH_DAY | DateUtils.FORMAT_SHOW_YEAR).toString();

I expect to have below results (in Polish):

Czerwiec 2020

but I am getting:

June 2020

Anyone have an idea what can be the problem?

K.Os
  • 5,123
  • 8
  • 40
  • 95
  • Does this answer your question? [DateUtils.formatDateRange() issues when formatting date range](https://stackoverflow.com/questions/35760788/dateutils-formatdaterange-issues-when-formatting-date-range) – rzwitserloot Jun 16 '20 at 13:28
  • SimpleDateFormat doesn't handle my case in this scenario – K.Os Jun 16 '20 at 13:41
  • How about this link?[link](https://stackoverflow.com/questions/21257014/set-language-to-french-in-android-datepickerdialog) – Sanjay Ravichandran Jun 16 '20 at 13:52
  • @K.Os SDF as well as JSR310 can print the same thing that would print, and unlike apache-commons, it's not a third party dep, is not crazy API, and does adhere to locale standards. – rzwitserloot Jun 16 '20 at 21:14

0 Answers0