Formatting a LocalDate in Java 8 using a specific Locale can be achieved like this:
DateTimeFormatter.ofLocalizedDate(FormatStyle.S
It seems that this Java-8-bug cannot be fixed in Java-9 because even the feature-extension-complete-date is already over. Let's see if it is going to be fixed in Java-10 which is still a long time away...
Of course, as one answer here suggests, you could try to process a given localized date pattern in order to remove irrelevant parts. But I still consider this approach as errorprone because there are still so many locales around. And indeed, the accepted answer is flawed for Chinese. Localized literals are here the main problem. Maybe the accepted answer can be fixed at least for this important language, but you might also consider two other libraries with good internationalization features which can solve your issue in a more reliable way.
a) ICU4J
DateFormat df = DateFormat.getInstanceForSkeleton(DateFormat.YEAR_MONTH, Locale.CHINESE);
String output = df.format(new Date());
System.out.println("ICU4J=" + output); // 2017年1月
However, one problem is lack of interoperability with Java-8-types, especially MonthDay and YearMonth. A solution requires something like Date.from(YearMonth.now().atDay(1).atStartOfDay(ZoneId.systemDefault()).toInstant()); Possible, but cumbersome.
b) my library Time4J (with the same data base as ICU4J)
ChronoFormatter cf =
ChronoFormatter.ofStyle(DisplayMode.FULL, Locale.CHINESE, CalendarMonth.chronology());
CalendarMonth cm =
CalendarMonth.from(YearMonth.now()); // or: CalendarMonth.nowInSystemTime()
System.out.println("Time4J=" + cf.format(cm)); // 2017年1月
Interoperability with Java-8 exists in the reverse direction, too. And the Time4J-counterpart for MonthDay is the class AnnualDate.
Side note: The accepted answer of @Julian yields for Chinese: 2017年1 (needs to be fixed)