I am trying to parse a LocalDate
with a custom formatter but it is throwing following error. What am I doing wrong?
Error:
// The local date time now value is 2019-09-19T14:42:23.837 java.time.format.DateTimeParseException: Text '2019-09-19T14:42:23.837' could not be parsed at index 10
Code:
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
LocalDateTime timeStamp = LocalDateTime.parse(LocalDateTime.now().toString(), formatter);