Here you can find the source of parseLocalDate(String dateString)
public static Optional<LocalDate> parseLocalDate(String dateString)
//package com.java2s; //License from project: Open Source License import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; import java.util.Optional; public class Main { private static DateTimeFormatter DEFAULT_DATE_FORMATTER = DateTimeFormatter.ISO_LOCAL_DATE_TIME; public static Optional<LocalDate> parseLocalDate(String dateString) { try {/*from w w w . ja va 2 s. co m*/ return Optional.of(DEFAULT_DATE_FORMATTER.parse(dateString, LocalDate::from)); } catch (DateTimeParseException e) { return Optional.empty(); } } }