xxxxxxxxxx
//Default pattern
LocalDateTime today = LocalDateTime.parse("2019-03-27T10:15:30");
System.out.println(today);
//Custom pattern
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss a");
LocalDateTime dateTime = LocalDateTime.parse("2019-03-27 10:15:30 AM", formatter);
System.out.println(dateTime);
xxxxxxxxxx
//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);