| Start | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Amount of time between two LocalTime There are two equivalent ways to calculate the amount of time unit between two |
||||||||||||||||||
| Intro LocalTime is an immutable class and thread-safe, used to represent time, often viewed as hour-min-sec. Time is represented to nanosecond precision. For example, the value "13:45.30.123456789" can be stored in a LocalTime. This class does not store or represent a date or time-zone. Instead, it is a description of the local time as seen on a wall clock. It cannot represent an instant on the time-line without additional information such as an offset or time-zone. This is a value based class, equals method should be used for comparisons. Fields MAX - The maximum supported LocalTime, '23:59:59.999999999'. MIDNIGHT, MIN, NOON Important Static Methods now(), now(Clock clock), now(ZoneId zone), parse(CharSequence text) Important Instance Methods isAfter(LocalTime other), isBefore(LocalTime other), minus(TemporalAmount amountToSubtract), minus(long amountToSubtract, TemporalUnit unit), plus(TemporalAmount amountToAdd), plus(long amountToAdd, TemporalUnit unit) Difference in time can be calculated in any of following ways You can also add/subtract hours, minutes or seconds from any object of LocalTime. minusHours(long hoursToSubtract), minusMinutes(long hoursToMinutes), minusNanos(long nanosToSubtract), minusSeconds(long secondsToSubtract), plusHours(long hoursToSubtract), plusMinutes(long hoursToMinutes), plusNanos(long nanosToSubtract), plusSeconds(long secondsToSubtract) |
||||||||||||||||||
| Time Modification You can add hours, minutes, seconds and nanoseconds: |
||||||||||||||||||
Time Zones and their time difference Syntax
Parameters
RemarksAs class name denotes, The class is value-based and the This class is from the package java.time. |
Read Article
https://develop.horje.com/learn/1434/reference