I am trying to create date time format for optional time part currently I implemented this
import java.time.*;
import java.time.format.DateTimeFormatter;
import j
Reason why you are getting null when you pass this is
"2017-07-01T00:00:00.0Z"
you have told the parser to expect 3 char format (see below .SSS)
DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss[.SSS]'Z'");
If you change it to .SS, it should work, however your last input i.e. 2017-07-01T00:00:00.000Z will break. You may want to include some logic to handle different formats