1package com.zetcode;
2
3import java.time.LocalTime;
4
5public class JavaLocalTimeParts {
6
7 public static void main(String[] args) {
8
9 LocalTime time = LocalTime.now();
10
11 System.out.printf("Hour: %s%n", time.getHour());
12 System.out.printf("Minute: %s%n", time.getMinute());
13 System.out.printf("Second: %s%n", time.getSecond());
14 }
15}
16
17 //The getHour() gets the hour part, the getMinute() gets the minute part, and the getSecond() the second part of the LocalTime.
18
19 //This is the output.
20 //Hour: 18
21 //Minute: 25
22 //Second: 55
23
24