Package | Description |
---|---|
java.time |
The main API for dates, times, instants, and durations.
|
Modifier and Type | Field | Description |
---|---|---|
static OffsetDateTime |
OffsetDateTime.MAX
The maximum supported
OffsetDateTime , '+999999999-12-31T23:59:59.999999999-18:00'. |
|
static OffsetDateTime |
OffsetDateTime.MIN
The minimum supported
OffsetDateTime , '-999999999-01-01T00:00:00+18:00'. |
Modifier and Type | Method | Description |
---|---|---|
OffsetDateTime |
OffsetTime.atDate (LocalDate date)
Combines this time with a date to create an
OffsetDateTime . |
|
OffsetDateTime |
LocalDateTime.atOffset (ZoneOffset offset)
Combines this date-time with an offset to create an
OffsetDateTime . |
|
OffsetDateTime |
Instant.atOffset (ZoneOffset offset)
Combines this instant with an offset to create an
OffsetDateTime . |
|
OffsetDateTime |
LocalDate.atTime (OffsetTime time)
Combines this date with an offset time to create an
OffsetDateTime . |
|
static OffsetDateTime |
OffsetDateTime.from (TemporalAccessor temporal)
Obtains an instance of
OffsetDateTime from a temporal object. |
|
OffsetDateTime |
OffsetDateTime.minus (long amountToSubtract,
TemporalUnit unit)
Returns a copy of this date-time with the specified amount subtracted.
|
|
OffsetDateTime |
OffsetDateTime.minus (TemporalAmount amountToSubtract)
Returns a copy of this date-time with the specified amount subtracted.
|
|
OffsetDateTime |
OffsetDateTime.minusDays (long days)
Returns a copy of this
OffsetDateTime with the specified number of days subtracted. |
|
OffsetDateTime |
OffsetDateTime.minusHours (long hours)
Returns a copy of this
OffsetDateTime with the specified number of hours subtracted. |
|
OffsetDateTime |
OffsetDateTime.minusMinutes (long minutes)
Returns a copy of this
OffsetDateTime with the specified number of minutes subtracted. |
|
OffsetDateTime |
OffsetDateTime.minusMonths (long months)
Returns a copy of this
OffsetDateTime with the specified number of months subtracted. |
|
OffsetDateTime |
OffsetDateTime.minusNanos (long nanos)
Returns a copy of this
OffsetDateTime with the specified number of nanoseconds subtracted. |
|
OffsetDateTime |
OffsetDateTime.minusSeconds (long seconds)
Returns a copy of this
OffsetDateTime with the specified number of seconds subtracted. |
|
OffsetDateTime |
OffsetDateTime.minusWeeks (long weeks)
Returns a copy of this
OffsetDateTime with the specified number of weeks subtracted. |
|
OffsetDateTime |
OffsetDateTime.minusYears (long years)
Returns a copy of this
OffsetDateTime with the specified number of years subtracted. |
|
static OffsetDateTime |
OffsetDateTime.now ()
Obtains the current date-time from the system clock in the default time-zone.
|
|
static OffsetDateTime |
OffsetDateTime.now (Clock clock)
Obtains the current date-time from the specified clock.
|
|
static OffsetDateTime |
OffsetDateTime.now (ZoneId zone)
Obtains the current date-time from the system clock in the specified time-zone.
|
|
static OffsetDateTime |
OffsetDateTime.of (int year,
int month,
int dayOfMonth,
int hour,
int minute,
int second,
int nanoOfSecond,
ZoneOffset offset)
Obtains an instance of
OffsetDateTime from a year, month, day,
hour, minute, second, nanosecond and offset. |
|
static OffsetDateTime |
OffsetDateTime.of (LocalDate date,
LocalTime time,
ZoneOffset offset)
Obtains an instance of
OffsetDateTime from a date, time and offset. |
|
static OffsetDateTime |
OffsetDateTime.of (LocalDateTime dateTime,
ZoneOffset offset)
Obtains an instance of
OffsetDateTime from a date-time and offset. |
|
static OffsetDateTime |
OffsetDateTime.ofInstant (Instant instant,
ZoneId zone)
Obtains an instance of
OffsetDateTime from an Instant and zone ID. |
|
static OffsetDateTime |
OffsetDateTime.parse (CharSequence text)
Obtains an instance of
OffsetDateTime from a text string
such as 2007年12月03日T10:15:30+01:00 . |
|
static OffsetDateTime |
OffsetDateTime.parse (CharSequence text,
DateTimeFormatter formatter)
Obtains an instance of
OffsetDateTime from a text string using a specific formatter. |
|
OffsetDateTime |
OffsetDateTime.plus (long amountToAdd,
TemporalUnit unit)
Returns a copy of this date-time with the specified amount added.
|
|
OffsetDateTime |
OffsetDateTime.plus (TemporalAmount amountToAdd)
Returns a copy of this date-time with the specified amount added.
|
|
OffsetDateTime |
OffsetDateTime.plusDays (long days)
Returns a copy of this OffsetDateTime with the specified number of days added.
|
|
OffsetDateTime |
OffsetDateTime.plusHours (long hours)
Returns a copy of this
OffsetDateTime with the specified number of hours added. |
|
OffsetDateTime |
OffsetDateTime.plusMinutes (long minutes)
Returns a copy of this
OffsetDateTime with the specified number of minutes added. |
|
OffsetDateTime |
OffsetDateTime.plusMonths (long months)
Returns a copy of this
OffsetDateTime with the specified number of months added. |
|
OffsetDateTime |
OffsetDateTime.plusNanos (long nanos)
Returns a copy of this
OffsetDateTime with the specified number of nanoseconds added. |
|
OffsetDateTime |
OffsetDateTime.plusSeconds (long seconds)
Returns a copy of this
OffsetDateTime with the specified number of seconds added. |
|
OffsetDateTime |
OffsetDateTime.plusWeeks (long weeks)
Returns a copy of this OffsetDateTime with the specified number of weeks added.
|
|
OffsetDateTime |
OffsetDateTime.plusYears (long years)
Returns a copy of this
OffsetDateTime with the specified number of years added. |
|
OffsetDateTime |
ZonedDateTime.toOffsetDateTime ()
Converts this date-time to an
OffsetDateTime . |
|
OffsetDateTime |
OffsetDateTime.truncatedTo (TemporalUnit unit)
Returns a copy of this
OffsetDateTime with the time truncated. |
|
OffsetDateTime |
OffsetDateTime.with (TemporalAdjuster adjuster)
Returns an adjusted copy of this date-time.
|
|
OffsetDateTime |
OffsetDateTime.with (TemporalField field,
long newValue)
Returns a copy of this date-time with the specified field set to a new value.
|
|
OffsetDateTime |
OffsetDateTime.withDayOfMonth (int dayOfMonth)
Returns a copy of this
OffsetDateTime with the day-of-month altered. |
|
OffsetDateTime |
OffsetDateTime.withDayOfYear (int dayOfYear)
Returns a copy of this
OffsetDateTime with the day-of-year altered. |
|
OffsetDateTime |
OffsetDateTime.withHour (int hour)
Returns a copy of this
OffsetDateTime with the hour-of-day altered. |
|
OffsetDateTime |
OffsetDateTime.withMinute (int minute)
Returns a copy of this
OffsetDateTime with the minute-of-hour altered. |
|
OffsetDateTime |
OffsetDateTime.withMonth (int month)
Returns a copy of this
OffsetDateTime with the month-of-year altered. |
|
OffsetDateTime |
OffsetDateTime.withNano (int nanoOfSecond)
Returns a copy of this
OffsetDateTime with the nano-of-second altered. |
|
OffsetDateTime |
OffsetDateTime.withOffsetSameInstant (ZoneOffset offset)
Returns a copy of this
OffsetDateTime with the specified offset ensuring
that the result is at the same instant. |
|
OffsetDateTime |
OffsetDateTime.withOffsetSameLocal (ZoneOffset offset)
Returns a copy of this
OffsetDateTime with the specified offset ensuring
that the result has the same local date-time. |
|
OffsetDateTime |
OffsetDateTime.withSecond (int second)
Returns a copy of this
OffsetDateTime with the second-of-minute altered. |
|
OffsetDateTime |
OffsetDateTime.withYear (int year)
Returns a copy of this
OffsetDateTime with the year altered. |
Modifier and Type | Method | Description |
---|---|---|
static Comparator<OffsetDateTime> |
OffsetDateTime.timeLineOrder ()
Gets a comparator that compares two
OffsetDateTime instances
based solely on the instant. |
Modifier and Type | Method | Description |
---|---|---|
int |
OffsetDateTime.compareTo (OffsetDateTime other)
Compares this date-time to another date-time.
|
|
boolean |
OffsetDateTime.isAfter (OffsetDateTime other)
Checks if the instant of this date-time is after that of the specified date-time.
|
|
boolean |
OffsetDateTime.isBefore (OffsetDateTime other)
Checks if the instant of this date-time is before that of the specified date-time.
|
|
boolean |
OffsetDateTime.isEqual (OffsetDateTime other)
Checks if the instant of this date-time is equal to that of the specified date-time.
|
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.