Package | Description |
---|---|
java.time |
The main API for dates, times, instants, and durations.
|
Modifier and Type | Field | Description |
---|---|---|
static OffsetTime |
OffsetTime.MAX
The maximum supported
OffsetTime , '23:59:59.999999999-18:00'. |
|
static OffsetTime |
OffsetTime.MIN
The minimum supported
OffsetTime , '00:00:00+18:00'. |
Modifier and Type | Method | Description |
---|---|---|
OffsetTime |
LocalTime.atOffset (ZoneOffset offset)
Combines this time with an offset to create an
OffsetTime . |
|
static OffsetTime |
OffsetTime.from (TemporalAccessor temporal)
Obtains an instance of
OffsetTime from a temporal object. |
|
OffsetTime |
OffsetTime.minus (long amountToSubtract,
TemporalUnit unit)
Returns a copy of this time with the specified amount subtracted.
|
|
OffsetTime |
OffsetTime.minus (TemporalAmount amountToSubtract)
Returns a copy of this time with the specified amount subtracted.
|
|
OffsetTime |
OffsetTime.minusHours (long hours)
Returns a copy of this
OffsetTime with the specified number of hours subtracted. |
|
OffsetTime |
OffsetTime.minusMinutes (long minutes)
Returns a copy of this
OffsetTime with the specified number of minutes subtracted. |
|
OffsetTime |
OffsetTime.minusNanos (long nanos)
Returns a copy of this
OffsetTime with the specified number of nanoseconds subtracted. |
|
OffsetTime |
OffsetTime.minusSeconds (long seconds)
Returns a copy of this
OffsetTime with the specified number of seconds subtracted. |
|
static OffsetTime |
OffsetTime.now ()
Obtains the current time from the system clock in the default time-zone.
|
|
static OffsetTime |
OffsetTime.now (Clock clock)
Obtains the current time from the specified clock.
|
|
static OffsetTime |
OffsetTime.now (ZoneId zone)
Obtains the current time from the system clock in the specified time-zone.
|
|
static OffsetTime |
OffsetTime.of (int hour,
int minute,
int second,
int nanoOfSecond,
ZoneOffset offset)
Obtains an instance of
OffsetTime from an hour, minute, second and nanosecond. |
|
static OffsetTime |
OffsetTime.of (LocalTime time,
ZoneOffset offset)
Obtains an instance of
OffsetTime from a local time and an offset. |
|
static OffsetTime |
OffsetTime.ofInstant (Instant instant,
ZoneId zone)
Obtains an instance of
OffsetTime from an Instant and zone ID. |
|
static OffsetTime |
OffsetTime.parse (CharSequence text)
Obtains an instance of
OffsetTime from a text string such as 10:15:30+01:00 . |
|
static OffsetTime |
OffsetTime.parse (CharSequence text,
DateTimeFormatter formatter)
Obtains an instance of
OffsetTime from a text string using a specific formatter. |
|
OffsetTime |
OffsetTime.plus (long amountToAdd,
TemporalUnit unit)
Returns a copy of this time with the specified amount added.
|
|
OffsetTime |
OffsetTime.plus (TemporalAmount amountToAdd)
Returns a copy of this time with the specified amount added.
|
|
OffsetTime |
OffsetTime.plusHours (long hours)
Returns a copy of this
OffsetTime with the specified number of hours added. |
|
OffsetTime |
OffsetTime.plusMinutes (long minutes)
Returns a copy of this
OffsetTime with the specified number of minutes added. |
|
OffsetTime |
OffsetTime.plusNanos (long nanos)
Returns a copy of this
OffsetTime with the specified number of nanoseconds added. |
|
OffsetTime |
OffsetTime.plusSeconds (long seconds)
Returns a copy of this
OffsetTime with the specified number of seconds added. |
|
OffsetTime |
OffsetDateTime.toOffsetTime ()
Converts this date-time to an
OffsetTime . |
|
OffsetTime |
OffsetTime.truncatedTo (TemporalUnit unit)
Returns a copy of this
OffsetTime with the time truncated. |
|
OffsetTime |
OffsetTime.with (TemporalAdjuster adjuster)
Returns an adjusted copy of this time.
|
|
OffsetTime |
OffsetTime.with (TemporalField field,
long newValue)
Returns a copy of this time with the specified field set to a new value.
|
|
OffsetTime |
OffsetTime.withHour (int hour)
Returns a copy of this
OffsetTime with the hour-of-day altered. |
|
OffsetTime |
OffsetTime.withMinute (int minute)
Returns a copy of this
OffsetTime with the minute-of-hour altered. |
|
OffsetTime |
OffsetTime.withNano (int nanoOfSecond)
Returns a copy of this
OffsetTime with the nano-of-second altered. |
|
OffsetTime |
OffsetTime.withOffsetSameInstant (ZoneOffset offset)
Returns a copy of this
OffsetTime with the specified offset ensuring
that the result is at the same instant on an implied day. |
|
OffsetTime |
OffsetTime.withOffsetSameLocal (ZoneOffset offset)
Returns a copy of this
OffsetTime with the specified offset ensuring
that the result has the same local time. |
|
OffsetTime |
OffsetTime.withSecond (int second)
Returns a copy of this
OffsetTime with the second-of-minute altered. |
Modifier and Type | Method | Description |
---|---|---|
OffsetDateTime |
LocalDate.atTime (OffsetTime time)
Combines this date with an offset time to create an
OffsetDateTime . |
|
int |
OffsetTime.compareTo (OffsetTime other)
Compares this
OffsetTime to another time. |
|
boolean |
OffsetTime.isAfter (OffsetTime other)
Checks if the instant of this
OffsetTime is after that of the
specified time applying both times to a common date. |
|
boolean |
OffsetTime.isBefore (OffsetTime other)
Checks if the instant of this
OffsetTime is before that of the
specified time applying both times to a common date. |
|
boolean |
OffsetTime.isEqual (OffsetTime other)
Checks if the instant of this
OffsetTime is equal to that of the
specified time applying both times to a common date. |
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
Scripting on this page tracks web page traffic, but does not change the content in any way.