I'm trying to convert a String with a value of a LocalDateTime
and convert it to the LocalDateTime
data type.
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSX");
LocalDateTime localDateTime = LocalDateTime.parse(dateTime, formatter);
and I've also tried using this:
LocalDateTime localDateTime = LocalDateTime.parse(dateTime);
But gets the same parsing error
java.time.format.DateTimeParseException: Text '2019-09-12T11:14:38.176906Z' could not be parsed at index 10
Value of the dateTime variable is (Generated before using LocalDateTime.now())
2019-09-12T11:14:38.176906Z