D
D
Daniel Demidko2019-06-25 13:07:00
Java
Daniel Demidko, 2019-06-25 13:07:00

How to add missing zeros to time?

LocalDateTime criticalPercentsStart;
LocalDateTime criticalPercentsFinish;

/* <***> */

final var fmt = DateTimeFormatter.ofPattern("H:m:s");
System.out.print(fmt.format(criticalPercentsStart));
System.out.print("    ");
System.out.print(fmt.format(criticalPercentsFinish));

At the output, I get this for example:
16:47:2 16:48:52
And I would like this:
16:47:02 16:48:52
That is, how to add zeros to the date for symmetry?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2019-06-25
@DanielDemidko

HH:mm:ss

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question