Java LocalDate Parse String like "12/28/2020"
import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; public class Main { public static void main(String[] args) { // Custom Parser String input = "12/28/2020"; try {/*w ww .j a va 2s .c o m*/ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); LocalDate ld3 = LocalDate.parse(input, formatter); System.out.println("Custom Parsed Date: " + ld3); } catch (DateTimeParseException ex) { System.out.println("Not parsable: " + ex); } } }