0

For example:

DateTimeFormatter dtfr = DateTimeFormatter.ofPattern("EEEE, MMMM d", locale);
return dtfr.format(localDate);

The result is (locale is Germany):

Expected :Samstag, 28. Mai
Actual   :Samstag, Mai 28

If I use

DateTimeFormatter dtf = DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL);
return dtf
            .withLocale(locale)
            .format(localDate1);

The result is:

Expected :Samstag, 28. Mai
Actual   :Samstag, 28. Mai 2016

I can't replace the year to "" simply, because the other language may have different word to describe year.

So how could I use DateTimeFormatter(not SimpleDateFormat) to make it to work?

Alex
  • 41
  • 1
  • 5
  • 2
    So you want `EEEE, d MMMM` instead? – Tunaki Oct 06 '16 at 09:40
  • If you want to print the day _before_ the month then why does your pattern state the opposite? It should be obvious that this doesn't work as such. Also why do you expect "Saturday, May 28" if the locale is German? – Thomas Oct 06 '16 at 09:40
  • Sorry, I didn't make it clear, I want the pattern change with the locale, the expected should be Samstag, 28 Mai, and without year. – Alex Oct 06 '16 at 17:06

0 Answers0