Java Utililty Methods LocalDate from String

List of utility methods to do LocalDate from String

Description

The list of methods to do LocalDate from String are organized into topic(s).

Method

LocalDategetLocalDateForString(final String string)
get Local Date For String
return LocalDate.parse(string, DateTimeFormatter.ofPattern(PATTERN_DATE));
LocalDategetLocalDateFromString(String sDate)
get Local Date From String
if (sDate == null || sDate.trim().isEmpty()) {
    return null;
DateTimeFormatter dateTimeFormatter;
LocalDate lDate = null;
try {
    dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
    lDate = LocalDate.parse(sDate, dateTimeFormatter);
...
OptionalparseLocalDate(String dateString)
parse Local Date
try {
    return Optional.of(DEFAULT_DATE_FORMATTER.parse(dateString, LocalDate::from));
} catch (DateTimeParseException e) {
    return Optional.empty();
LocalDateparseLocalDate(String inPattern, String inDate)
parse Local Date
final DateTimeFormatter f = DateTimeFormatter.ofPattern(inPattern);
return LocalDate.from(f.parse(inDate));
LocalDateparseLocalDate(String localDate)
parse Local Date
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
return LocalDate.parse(localDate, formatter);
LocalDateparseStringToLocalDate(String strDate)
Parses a String into a LocalDate
return LocalDate.parse(strDate, localDateFormatter);
LocalDatetoLocalDate(String date)
to Local Date
DateTimeFormatter format = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss", Locale.getDefault());
return LocalDate.parse(date, format);
LocalDatetoLocalDate(String date)
to Local Date
return LocalDate.parse(date, DATE_FORMAT);
LocalDatetoLocalDate(String dateValue)
This method parse date from String object to LocalDate object.
return LocalDate.parse(trimQuotes(dateValue), DateTimeFormatter.ofPattern("M/dd/yyyy"));