LocalDateTime.parse(\"2017-02-02 08:59:12\", DateTimeFormatter.ofPattern(\"yyyy-MM-dd hh:mm:ss\"));
It prints error:
java.time.format
I can only reproduce the exception you get when I try to parse to a LocalDateTime
, so I assume that's what you want.
Your mistake is using hh
(clock-hour-of-am-pm) instead of HH
(hour-of-day). This works:
LocalDateTime ldt = LocalDateTime.parse("2017-02-02 08:59:12", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
System.out.println(ldt);
And prints:
2017-02-02T08:59:12