The maximum supported LocalTime
, '23:59:59.999999999'.
The maximum supported LocalTime
, '23:59:59.999999999'.
This is the time just before midnight at the end of the day.
The time of midnight at the start of the day, '00:00'.
The minimum supported LocalTime
, '00:00'.
The minimum supported LocalTime
, '00:00'.
This is the time of midnight at the start of the day.
The time of noon in the middle of the day, '12:00'.
Obtains an instance of LocalTime
from a temporal object.
Obtains an instance of LocalTime
from a temporal object.
A TemporalAccessor
represents some form of date and time information.
This factory converts the arbitrary temporal object to an instance of LocalTime
.
The conversion uses the TemporalQueries#localTime()
query, which relies
on extracting the NANO_OF_DAY
field.
This method matches the signature of the functional interface TemporalQuery
allowing it to be used in queries via method reference, LocalTime::from
.
the temporal object to convert, not null
the local time, not null
DateTimeException
if unable to convert to a { @code LocalTime}
Obtains the current time from the specified clock.
Obtains the current time from the specified clock.
This will query the specified clock to obtain the current time.
Using this method allows the use of an alternate clock for testing.
The alternate clock may be introduced using dependency injection
.
the clock to use, not null
the current time, not null
Obtains the current time from the system clock in the specified time-zone.
Obtains the current time from the system clock in the specified time-zone.
This will query the system clock
to obtain the current time.
Specifying the time-zone avoids dependence on the default time-zone.
Using this method will prevent the ability to use an alternate clock for testing because the clock is hard-coded.
the zone ID to use, not null
the current time using the system clock, not null
Obtains the current time from the system clock in the default time-zone.
Obtains the current time from the system clock in the default time-zone.
This will query the system clock
in the default
time-zone to obtain the current time.
Using this method will prevent the ability to use an alternate clock for testing because the clock is hard-coded.
the current time using the system clock and default time-zone, not null
Obtains an instance of LocalTime
from an hour, minute, second and nanosecond.
Obtains an instance of LocalTime
from an hour, minute, second and nanosecond.
This factory may return a cached value, but applications must not rely on this.
the hour-of-day to represent, from 0 to 23
the minute-of-hour to represent, from 0 to 59
the second-of-minute to represent, from 0 to 59
the nano-of-second to represent, from 0 to 999,999,999
the local time, not null
DateTimeException
if the value of any field is out of range
Obtains an instance of LocalTime
from an hour, minute and second.
Obtains an instance of LocalTime
from an hour, minute and second.
The nanosecond field will be set to zero by this factory method.
This factory may return a cached value, but applications must not rely on this.
the hour-of-day to represent, from 0 to 23
the minute-of-hour to represent, from 0 to 59
the second-of-minute to represent, from 0 to 59
the local time, not null
DateTimeException
if the value of any field is out of range
Obtains an instance of LocalTime
from an hour and minute.
Obtains an instance of LocalTime
from an hour and minute.
The second and nanosecond fields will be set to zero by this factory method.
This factory may return a cached value, but applications must not rely on this.
the hour-of-day to represent, from 0 to 23
the minute-of-hour to represent, from 0 to 59
the local time, not null
DateTimeException
if the value of any field is out of range
Obtains an instance of LocalTime
from a nanos-of-day value.
Obtains an instance of LocalTime
from a nanos-of-day value.
This factory may return a cached value, but applications must not rely on this.
the nano of day, from { @code 0} to { @code 24 * 60 * 60 * 1,000,000,000 - 1}
the local time, not null
DateTimeException
if the nanos of day value is invalid
Obtains an instance of LocalTime
from a second-of-day value.
Obtains an instance of LocalTime
from a second-of-day value.
This factory may return a cached value, but applications must not rely on this.
the second-of-day, from { @code 0} to { @code 24 * 60 * 60 - 1}
the local time, not null
DateTimeException
if the second-of-day value is invalid
Obtains an instance of LocalTime
from a text string using a specific formatter.
Obtains an instance of LocalTime
from a text string using a specific formatter.
The text is parsed using the formatter, returning a time.
the text to parse, not null
the formatter to use, not null
the parsed local time, not null
DateTimeParseException
if the text cannot be parsed
Obtains an instance of LocalTime
from a text string such as 10:15
.
Obtains an instance of LocalTime
from a text string such as 10:15
.
The string must represent a valid time and is parsed using
org.threeten.bp.format.DateTimeFormatter#ISO_LOCAL_TIME
.
the text to parse such as "10:15:30", not null
the parsed local time, not null
DateTimeParseException
if the text cannot be parsed