- LocalTime time = LocalTime.now(); // Initializes with current system clock
- LocalTime time = LocalTime.MIDNIGHT; // 00:00
- LocalTime time = LocalTime.NOON; // 12:00
- LocalTime time = LocalTime.of(12, 12, 45); // 12:12:45
LocalTime.of(13, 12, 11)
|Current time from system clock|
|The maximum supported local time 23:59:59.999999999|
|The minimum supported local time 00:00|
|23:59:59 , Obtains Time from second-of-day value|
|00:00:02 , Obtains Time from nanos-of-day value|
As class name denotes,
LocalTime represents a time without a time-zone. It doesn't represent a date. It's a simple label for a given time.
The class is value-based and the
equals method should be used when doing comparisons.
This class is from the package java.time.
Localization and Internationalization
Amount of time between two LocalTime
This modified text is an extract of the original Stack Overflow Documentation created by following contributors
and released under CC BY-SA 3.0