Here you can find the source of getLocalDate(String dateStr, String formatStr)
public static LocalDate getLocalDate(String dateStr, String formatStr)
//package com.java2s; import com.google.common.base.Strings; import java.time.*; import java.time.format.DateTimeFormatter; import java.time.temporal.TemporalAccessor; import java.util.Date; public class Main { public static LocalDate getLocalDate(Date date) { return LocalDate.from(date.toInstant()); }/* ww w . ja v a 2 s .c o m*/ public static LocalDate getLocalDate(String dateStr, String formatStr) { if (Strings.isNullOrEmpty(dateStr)) { return null; } final DateTimeFormatter dtf = DateTimeFormatter.ofPattern(formatStr); TemporalAccessor temp = dtf.parse(dateStr); return LocalDate.from(temp); } }