To use just the time part of a Date use LocalTime. You can instantiate a LocalTime object in a couple ways
LocalTime time = LocalTime.now();
time = LocalTime.MIDNIGHT;
time = LocalTime.NOON;
time = LocalTime.of(12, 12, 45);
LocalTime also has a built in toString method that displays the format very nicely.
you can also get, add and subtract hours, minutes, seconds, and nanoseconds from the LocalTime object i.e.
time.plusMinutes(1); time.getMinutes(); time.minusMinutes(1);
You can turn it into a Date object with the following code:
LocalTime lTime = LocalTime.now(); Instant instant = lTime.atDate(LocalDate.of(A_YEAR, A_MONTH, A_DAY)). atZone(ZoneId.systemDefault()).toInstant(); Date time = Date.from(instant);
this class works very nicely within a timer class to simulate an alarm clock.