title: How to format YearMonth and MonthDay depending on a Locale?
body: <p>Formatting a <code>LocalDate</code> in Java 8 using a specific <code>Locale</code> can be achieved like this:</p>
  
  <pre><code>DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).withLocale(myLocale).format(value);
  DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM).withLocale(myLocale).format(value);
  DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG).withLocale(myLocale).format(value);
  DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL).withLocale(myLocale).format(value);
  </code></pre>
  
  <p>Assuming <code>value = LocalDate.now()</code> this would result into:</p>
  
  <pre><code>// myLocale = Locale.ENGLISH
  6/30/16
  Jun 30, 2016
  June 30, 2016
  Thursday, June 30, 2016
  
  // myLocale = Locale.GERMAN
  30.06.16
  30.06.2016
  30. Juni 2016
  Donnerstag, 30. Juni 2016
  
  // myLocale = new Locale("es", "ES")
  30/06/16
  30-jun-2016
  30 de junio de 2016
  jueves 30 de junio de 2016
  </code></pre>
  
  <p>As you can see Java decides which delimiter ("-", ".", "/", " ", etc.) to use and how to sort the date elements (e.g. month before day or vice versa, etc - in some locales it could be that year comes first, etc.).</p>
  
  <p><strong>My question is:</strong> How can I format a <code>java.time.YearMonth</code> and <code>java.time.MonthDay</code> depending on a <code>Locale</code> like the example above?</p>
  
  <p>Based on the example I would expect results like this...</p>
  
  <p>... for <code>YearMonth</code>:</p>
  
  <pre><code>// myLocale = Locale.ENGLISH
  6/16
  Jun, 2016
  June, 2016
  June, 2016
  
  // myLocale = Locale.GERMAN
  06.16
  06.2016
  Juni 2016
  Juni 2016
  
  // myLocale = new Locale("es", "ES")
  06/16
  jun-2016
  de junio de 2016
  de junio de 2016
  </code></pre>
  
  <p>... for <code>MonthDay</code>:</p>
  
  <pre><code>// myLocale = Locale.ENGLISH
  6/30
  Jun 30
  June 30
  June 30
  
  // myLocale = Locale.GERMAN
  30.06.
  30.06.
  30. Juni
  30. Juni
  
  // myLocale = new Locale("es", "ES")
  30/06
  30-jun
  30 de junio de
  30 de junio de
  </code></pre>
  
  <p>Of course there could be other <code>Locale</code>s which use completely different delimiters and ordering.</p>
  
  <p>Thank you!</p>