Java LocalDate parse String using DateTimeFormatter predefined format
import java.time.LocalDate; import java.time.format.DateTimeFormatter; public class Main { public static void main(String[] args) { // Using a different Parser LocalDate ld2 = LocalDate.parse("2020-12-28", DateTimeFormatter.ISO_DATE); System.out.println("Different Parser: " + ld2); }/*from w w w .j a va 2 s . com*/ }