Uses of Class
java.time.LocalTime
Package
Description
Provides the API for accessing and processing data stored in a
data source (usually a relational database) using the
Java programming language.
The main API for dates, times, instants, and durations.
Generic API for calendar systems other than the default ISO.
Access to date and time using fields and units, and date time adjusters.
Support for time-zones and their rules.
-
Uses of LocalTime in java.sql
-
Uses of LocalTime in java.time
Modifier and TypeFieldDescriptionstatic LocalTime
LocalTime.MAX
The maximum supportedLocalTime
, '23:59:59.999999999'.static LocalTime
LocalTime.MIDNIGHT
The time of midnight at the start of the day, '00:00'.static LocalTime
LocalTime.MIN
The minimum supportedLocalTime
, '00:00'.static LocalTime
LocalTime.NOON
The time of noon in the middle of the day, '12:00'.Modifier and TypeMethodDescriptionstatic LocalTime
LocalTime.from(TemporalAccessor temporal)
Obtains an instance ofLocalTime
from a temporal object.LocalTime.minus(long amountToSubtract, TemporalUnit unit)
Returns a copy of this time with the specified amount subtracted.LocalTime.minus(TemporalAmount amountToSubtract)
Returns a copy of this time with the specified amount subtracted.LocalTime.minusHours(long hoursToSubtract)
Returns a copy of thisLocalTime
with the specified number of hours subtracted.LocalTime.minusMinutes(long minutesToSubtract)
Returns a copy of thisLocalTime
with the specified number of minutes subtracted.LocalTime.minusNanos(long nanosToSubtract)
Returns a copy of thisLocalTime
with the specified number of nanoseconds subtracted.LocalTime.minusSeconds(long secondsToSubtract)
Returns a copy of thisLocalTime
with the specified number of seconds subtracted.static LocalTime
LocalTime.now()
Obtains the current time from the system clock in the default time-zone.static LocalTime
Obtains the current time from the specified clock.static LocalTime
Obtains the current time from the system clock in the specified time-zone.static LocalTime
LocalTime.of(int hour, int minute)
Obtains an instance ofLocalTime
from an hour and minute.static LocalTime
LocalTime.of(int hour, int minute, int second)
Obtains an instance ofLocalTime
from an hour, minute and second.static LocalTime
LocalTime.of(int hour, int minute, int second, int nanoOfSecond)
Obtains an instance ofLocalTime
from an hour, minute, second and nanosecond.static LocalTime
Obtains an instance ofLocalTime
from anInstant
and zone ID.static LocalTime
LocalTime.ofNanoOfDay(long nanoOfDay)
Obtains an instance ofLocalTime
from a nanos-of-day value.static LocalTime
LocalTime.ofSecondOfDay(long secondOfDay)
Obtains an instance ofLocalTime
from a second-of-day value.static LocalTime
LocalTime.parse(CharSequence text)
Obtains an instance ofLocalTime
from a text string such as10:15
.static LocalTime
LocalTime.parse(CharSequence text, DateTimeFormatter formatter)
Obtains an instance ofLocalTime
from a text string using a specific formatter.LocalTime.plus(long amountToAdd, TemporalUnit unit)
Returns a copy of this time with the specified amount added.LocalTime.plus(TemporalAmount amountToAdd)
Returns a copy of this time with the specified amount added.LocalTime.plusHours(long hoursToAdd)
Returns a copy of thisLocalTime
with the specified number of hours added.LocalTime.plusMinutes(long minutesToAdd)
Returns a copy of thisLocalTime
with the specified number of minutes added.LocalTime.plusNanos(long nanosToAdd)
Returns a copy of thisLocalTime
with the specified number of nanoseconds added.LocalTime.plusSeconds(long secondstoAdd)
Returns a copy of thisLocalTime
with the specified number of seconds added.LocalDateTime.toLocalTime()
Gets theLocalTime
part of this date-time.OffsetDateTime.toLocalTime()
Gets theLocalTime
part of this date-time.OffsetTime.toLocalTime()
Gets theLocalTime
part of this date-time.ZonedDateTime.toLocalTime()
Gets theLocalTime
part of this date-time.LocalTime.truncatedTo(TemporalUnit unit)
Returns a copy of thisLocalTime
with the time truncated.LocalTime.with(TemporalAdjuster adjuster)
Returns an adjusted copy of this time.LocalTime.with(TemporalField field, long newValue)
Returns a copy of this time with the specified field set to a new value.LocalTime.withHour(int hour)
Returns a copy of thisLocalTime
with the hour-of-day altered.LocalTime.withMinute(int minute)
Returns a copy of thisLocalTime
with the minute-of-hour altered.LocalTime.withNano(int nanoOfSecond)
Returns a copy of thisLocalTime
with the nano-of-second altered.LocalTime.withSecond(int second)
Returns a copy of thisLocalTime
with the second-of-minute altered.Modifier and TypeMethodDescriptionCombines this date with a time to create aLocalDateTime
.int
Compares this time to another time.boolean
Checks if this time is after the specified time.boolean
Checks if this time is before the specified time.static LocalDateTime
Obtains an instance ofLocalDateTime
from a date and time.static OffsetDateTime
OffsetDateTime.of(LocalDate date, LocalTime time, ZoneOffset offset)
Obtains an instance ofOffsetDateTime
from a date, time and offset.static OffsetTime
OffsetTime.of(LocalTime time, ZoneOffset offset)
Obtains an instance ofOffsetTime
from a local time and an offset.static ZonedDateTime
Obtains an instance ofZonedDateTime
from a local date and time.long
LocalDate.toEpochSecond(LocalTime time, ZoneOffset offset)
Converts thisLocalDate
to the number of seconds since the epoch of 1970-01-01T00:00:00Z. -
Uses of LocalTime in java.time.chrono
Modifier and TypeMethodDescriptionChronoLocalDateTime.toLocalTime()
Gets the local time part of this date-time.default LocalTime
ChronoZonedDateTime.toLocalTime()
Gets the local time part of this date-time.Modifier and TypeMethodDescriptiondefault ChronoLocalDateTime<?>
Combines this date with a time to create aChronoLocalDateTime
. -
Uses of LocalTime in java.time.temporal
Modifier and TypeMethodDescriptionstatic TemporalQuery<LocalTime>
TemporalQueries.localTime()
A query forLocalTime
returning null if not found. -
Uses of LocalTime in java.time.zone
Modifier and TypeMethodDescriptionZoneOffsetTransitionRule.getLocalTime()
Gets the local time of day of the transition which must be checked withZoneOffsetTransitionRule.isMidnightEndOfDay()
.Modifier and TypeMethodDescriptionstatic ZoneOffsetTransitionRule
ZoneOffsetTransitionRule.of(Month month, int dayOfMonthIndicator, DayOfWeek dayOfWeek, LocalTime time, boolean timeEndOfDay, ZoneOffsetTransitionRule.TimeDefinition timeDefinition, ZoneOffset standardOffset, ZoneOffset offsetBefore, ZoneOffset offsetAfter)
Obtains an instance defining the yearly rule to create transitions between two offsets.