Parse a string to LocalDate using Medium German format
Description
The following code shows how to parse a string to LocalDate using Medium German format.
Example
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.util.Locale;
/*w w w.ja v a 2 s .c om*/
public class Main {
public static void main(String... args) {
DateTimeFormatter germanFormatter = DateTimeFormatter.ofLocalizedDate(
FormatStyle.MEDIUM).withLocale(Locale.GERMAN);
LocalDate xmas = LocalDate.parse("24.12.2014", germanFormatter);
System.out.println(xmas);
}
}
The code above generates the following result.