Use correct formatting codes. Read the Javadoc more carefully.
Input means fractional second in microseconds range?
If the last digits represent a fraction of second, this code works. Your seven digits for a fractional second is unusual; increments of 3 (3, 6, or 9) is more common. But we can make it work.
String input = "20190911T14:37:08.7770400" ;
DateTimeFormatter f = DateTimeFormatter.ofPattern( "uuuuMMdd'T'HH:mm:ss.SSSSSSS" ) ;
LocalDateTime ldt = LocalDateTime.parse( input , f ) ;
See this code run live at IdeOne.com.
ldt.toString(): 2019-09-11T14:37:08.777040
Input means offset? Faulty input.
If the last digits were intended to be a combination of a fractional second in milliseconds and four digits for an offset-from-UTC (a number of hours and minutes), then your input is faulty. An offset is either ahead of UTC or it is behind UTC. So an offset must include either a plus sign +
or a minus sign -
. Your input has neither, so such a string cannot be parsed for its offset-from-UTC.
See this Question, Parsing ISO-8601 DateTime in java.
ISO 8601
The format of your input string is terrible, apparently a clumsy mangling of the standard ISO 8601 format. For example: 2013-04-03T17:04:39.9437823+04:00
. I strongly suggest you educate the publisher of this data about the ISO 8601 standard. Do not invent new formats, stick with the standard.
The java.time classes use the ISO 8601 formats by default when parsing/generating strings. So, no need to specify a formatting pattern at all!
Another thing: If you are trying to track moments, actual points on the timeline, then you must include an offset or time zone with input. Without that context, we do not know if the input meant 2 PM in Tokyo Japan or 2 PM in Toledo Ohio US — two very different moments, happening several hours apart.