LocalTime (Java SE 26 & JDK 26)
- All Implemented Interfaces:
Serializable, Comparable<LocalTime>, Temporal, TemporalAccessor, TemporalAdjuster
-
Field Summary
Fields
The maximum supported
LocalTime, '23:59:59.999999999'.The time of midnight at the start of the day, '00:00'.
The minimum supported
LocalTime, '00:00'.The time of noon in the middle of the day, '12:00'.
-
Method Summary
Adjusts the specified temporal object to have the same time as this object.
Combines this time with a date to create a
LocalDateTime.Combines this time with an offset to create an
OffsetTime.intCompares this time to another time.
booleanChecks if this time is equal to another time.
Formats this time using the specified formatter.
Obtains an instance of
LocalTimefrom a temporal object.intGets the value of the specified field from this time as an
int.intgetHour()Gets the hour-of-day field.
longGets the value of the specified field from this time as a
long.intGets the minute-of-hour field.
intgetNano()Gets the nano-of-second field.
intGets the second-of-minute field.
inthashCode()A hash code for this time.
booleanChecks if this time is after the specified time.
booleanChecks if this time is before the specified time.
booleanChecks if the specified field is supported.
booleanChecks if the specified unit is supported.
Returns a copy of this time with the specified amount subtracted.
Returns a copy of this time with the specified amount subtracted.
minusHours(long hoursToSubtract) Returns a copy of this
LocalTimewith the specified number of hours subtracted.minusMinutes(long minutesToSubtract) Returns a copy of this
LocalTimewith the specified number of minutes subtracted.minusNanos(long nanosToSubtract) Returns a copy of this
LocalTimewith the specified number of nanoseconds subtracted.minusSeconds(long secondsToSubtract) Returns a copy of this
LocalTimewith the specified number of seconds subtracted.now()Obtains the current time from the system clock in the default time-zone.
Obtains the current time from the specified clock.
Obtains the current time from the system clock in the specified time-zone.
of(int hour, int minute) Obtains an instance of
LocalTimefrom an hour and minute.of(int hour, int minute, int second) Obtains an instance of
LocalTimefrom an hour, minute and second.of(int hour, int minute, int second, int nanoOfSecond) Obtains an instance of
LocalTimefrom an hour, minute, second and nanosecond.Obtains an instance of
LocalTimefrom anInstantand zone ID.ofNanoOfDay(long nanoOfDay) Obtains an instance of
LocalTimefrom a nanos-of-day value.ofSecondOfDay(long secondOfDay) Obtains an instance of
LocalTimefrom a second-of-day value.Obtains an instance of
LocalTimefrom a text string such as10:15.Obtains an instance of
LocalTimefrom a text string using a specific formatter.Returns a copy of this time with the specified amount added.
Returns a copy of this time with the specified amount added.
plusHours(long hoursToAdd) Returns a copy of this
LocalTimewith the specified number of hours added.plusMinutes(long minutesToAdd) Returns a copy of this
LocalTimewith the specified number of minutes added.plusNanos(long nanosToAdd) Returns a copy of this
LocalTimewith the specified number of nanoseconds added.plusSeconds(long secondstoAdd) Returns a copy of this
LocalTimewith the specified number of seconds added.<R> RQueries this time using the specified query.
Gets the range of valid values for the specified field.
longConverts this
LocalTimeto the number of seconds since the epoch of 1970-01-01T00:00:00Z.longExtracts the time as nanos of day, from
0to24 * 60 * 60 * 1,000,000,000 - 1.intExtracts the time as seconds of day, from
0to24 * 60 * 60 - 1.toString()Outputs this time as a
String, such as10:15.Returns a copy of this
LocalTimewith the time truncated.longCalculates the amount of time until another time in terms of the specified unit.
Returns an adjusted copy of this time.
Returns a copy of this time with the specified field set to a new value.
withHour(int hour) Returns a copy of this
LocalTimewith the hour-of-day altered.withMinute(int minute) Returns a copy of this
LocalTimewith the minute-of-hour altered.withNano(int nanoOfSecond) Returns a copy of this
LocalTimewith the nano-of-second altered.withSecond(int second) Returns a copy of this
LocalTimewith the second-of-minute altered.Methods declared in class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitCreates and returns a copy of this object.
protected voidDeprecated, for removal: This API element is subject to removal in a future version.
Returns the runtime class of this
Object.final voidWakes up a single thread that is waiting on this object's monitor.
final voidWakes up all threads that are waiting on this object's monitor.
final voidCauses the current thread to wait until it is awakened, typically by being notified or interrupted.
final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Field Details
-
MIN
-
MAX
-
MIDNIGHT
-
NOON
-
-
Method Details
-
now
-
now
-
now
-
of
-
of
-
of
-
ofInstant
-
ofSecondOfDay
-
ofNanoOfDay
-
from
-
parse
-
parse
-
isSupported
-
isSupported
-
range
-
get
-
getLong
-
getHour
-
getMinute
-
getSecond
-
getNano
-
with
-
with
-
withHour
-
withMinute
-
withSecond
-
withNano
-
truncatedTo
-
plus
-
plus
-
plusHours
-
plusMinutes
-
plusSeconds
-
plusNanos
-
minus
-
minus
-
minusHours
-
minusMinutes
-
minusSeconds
-
minusNanos
-
query
-
adjustInto
-
until
-
format
-
atDate
-
atOffset
-
toSecondOfDay
-
toNanoOfDay
-
toEpochSecond
-
compareTo
-
isAfter
-
isBefore
-
equals
-
hashCode
-
toString
-