Welcome to the Ranch
I presume you are parsing the strings into date‑time objects correctly, but why not find out about reading times with format objects. That would obviate the long lines, for one thing.
Classes like LocalDateTime have lots of
methods some of which can get the individual fields so you can use them with
System.out.printf("...%d...",...);
There are doubtless other ways to get a date formatted nicely: try the
Java™ Tutorials.