java localdate convert string to date code example
Example 1: convert string to localdatetime
//convert String to LocalDateTime
String str = "2016-03-04 11:30";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
LocalDateTime dateTime = LocalDateTime.parse(str, formatter);
Example 2: java convert java.util.Date to LocalDate
Date yourDate = new Date(); // this will be your java.util.Date instance to convert
LocalDate date = yourDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();