The simplest use of this class is as an alternative get method, here used to get the minute '30'.
LocalTime dt = new LocalTime(12, 30); int year = dt.minuteOfHour().get();
Methods are also provided that allow time modification. These return new instances of LocalTime - they do not modify the original. The example below yields two independent immutable date objects 2 hours apart.
LocalTime dt1230 = new LocalTime(12, 30); LocalTime dt1430 = dt1230.hourOfDay().setCopy(14);
LocalTime.Property itself is thread-safe and immutable, as well as the LocalTime being operated on. @author Stephen Colebourne @author Brian S O'Neill @since 1.3
|
|
|
|