convert String “yyyy-MM-dd” to LocalDateTime
问题 Is there any way to convert a date String to LocalDateTime where the format "yyyy-MM-dd" ? If I try this: DateTimeFormatter DATEFORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd"); LocalDateTime ldt = LocalDateTime.parse(string, DATEFORMATTER); I got this exception: java.time.format.DateTimeParseException: Text '2017-03-13' could not be parsed: Unable to obtain LocalDateTime from TemporalAccessor: {},ISO resolved to 2017-03-13 of type java.time.format.Parsed at java.time.format