3

I have a string coming from a file, that depicts the datetime. I'm trying to get the right datetime from it, like:

LocalDateTime.parse("20151120184616363", DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"));

But this gives an error: Text '20151120184616363' could not be parsed at index 0

Small changes do work, like putting a space after the days, or even the seconds.

LocalDateTime.parse("20151120184616 363", DateTimeFormatter.ofPattern("yyyyMMddHHmmss SSS"));

But I'd rather not do extra operations, I have to repeat it quite a bit. Can someone tell me what goes wrong in the first case?

Johan
  • 3,202
  • 1
  • 23
  • 19

0 Answers0