LocalTime

Methods
28
Fields
4

Getting one

LocalTime.now()
LocalTime.of(…)
LocalTime.ofSecondOfDay(…)

Methods

MethodReturnsDescription
getHour()numberThe hour, 0 to 23.
getMinute()numberThe minute, 0 to 59.
getSecond()numberThe second, 0 to 59.
getNano()numberThe nano-of-second.
toSecondOfDay()numberSeconds since midnight.
toNanoOfDay()numberNanoseconds since midnight.
plusHours(number)LocalTimePlus hoursToAdd hours, wrapping around midnight.
plusMinutes(number)LocalTimePlus minutesToAdd minutes, wrapping.
plusSeconds(number)LocalTimePlus secondstoAdd seconds, wrapping.
plusNanos(number)LocalTimePlus nanosToAdd ns, wrapping.
minusHours(number)LocalTimeLess hoursToSubtract hours, wrapping.
minusMinutes(number)LocalTimeLess minutesToSubtract minutes, wrapping.
minusSeconds(number)LocalTimeLess secondsToSubtract seconds, wrapping.
withHour(number)LocalTimeThe same time with hour.
withMinute(number)LocalTimeThe same time with minute.
withSecond(number)LocalTimeThe same time with second.
withNano(number)LocalTimeThe same time with nanoOfSecond.
isAfter(LocalTime)booleanWhether this is after other.
isBefore(LocalTime)booleanWhether this is before other.
compareTo(LocalTime)number-1, 0 or 1 by hour, then minute, second and nano.
format(DateTimeFormatter)stringformatter's text for this time.
equals(any)booleanWhether other is an equal LocalTime.
hashCode()numberThe value's hash.
toString()stringHH:mm, then :ss and a fraction when present.
now()LocalTime() -> LocalTime: The time now in the system zone.
now(ZoneId)LocalTime
of(number, number)LocalTime(number, number) -> LocalTime: hour:minute.
of(number, number, number)LocalTime
of(number, number, number, number)LocalTime
ofSecondOfDay(number)LocalTimeThe time secondOfDay seconds after midnight (0 to 86,399).
ofNanoOfDay(number)LocalTimeThe time nanoOfDay ns after midnight.

Fields

FieldTypeDescription
MIDNIGHTLocalTime00:00.
NOONLocalTime12:00.
MINLocalTime00:00.
MAXLocalTime23:59:59.999999999.

Returned by

MethodReturnsDescription
LocalDateTime.toLocalTimeLocalTimeThe time.
LocalTimeClass.nowLocalTime() -> LocalTime: The time now in the system zone.
LocalTimeClass.ofLocalTime(number, number) -> LocalTime: hour:minute.
LocalTimeClass.ofNanoOfDayLocalTimeThe time nanoOfDay ns after midnight.
LocalTimeClass.ofSecondOfDayLocalTimeThe time secondOfDay seconds after midnight (0 to 86,399).
ZonedDateTime.toLocalTimeLocalTimeThe local time there.

Method details

equals

equals: (LocalTime, any) -> boolean

Whether other is an equal LocalTime.

now

now: (() -> LocalTime) & ((ZoneId) -> LocalTime)

() -> LocalTime: The time now in the system zone.

(ZoneId) -> LocalTime: The time now in zone.

of

of: ((number, number) -> LocalTime) & ((number, number, number) -> LocalTime) & ((number, number, number, number) -> LocalTime)

(number, number) -> LocalTime: hour:minute.

(number, number, number) -> LocalTime: hour:minute:second.

(number, number, number, number) -> LocalTime: hour:minute:second.nanoOfSecond.