I'm new to java and I'm not understanding what's wrong with my date parsing. I've tried many of the solutions to similar posts, read the DateTimeFormatter documentation and am still stuck. Any help is appreciated. Thank you.
Code
String date = "2021-02-19T00:45:09.798Z"
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("uuuu-MM-dd'T'HH:mm:ss.SSSZ");
ZonedDateTime parsedDate = ZonedDateTime.parse(date, formatter);
Error
java.time.format.DateTimeParseException: Text '2021-02-19T00:45:09.798Z' could not be parsed, unparsed text found at index 23
I've also tried using DateTimeFormatter.ofPattern(pattern).withZone(zone)
and receive the same error.