OffsetDateTime (Java SE 26 & JDK 26)
- All Implemented Interfaces:
Serializable, Comparable<OffsetDateTime>, Temporal, TemporalAccessor, TemporalAdjuster
-
Field Summary
Fields
The maximum supported
OffsetDateTime, '+999999999-12-31T23:59:59.999999999-18:00'.The minimum supported
OffsetDateTime, '-999999999-01-01T00:00:00+18:00'. -
Method Summary
Adjusts the specified temporal object to have the same offset, date and time as this object.
Combines this date-time with a time-zone to create a
ZonedDateTimeensuring that the result has the same instant.Combines this date-time with a time-zone to create a
ZonedDateTimetrying to keep the same local date and time.intCompares this date-time to another date-time.
booleanChecks if this date-time is equal to another date-time.
Formats this date-time using the specified formatter.
Obtains an instance of
OffsetDateTimefrom a temporal object.intGets the value of the specified field from this date-time as an
int.intGets the day-of-month field.
Gets the day-of-week field, which is an enum
DayOfWeek.intGets the day-of-year field.
intgetHour()Gets the hour-of-day field.
longGets the value of the specified field from this date-time as a
long.intGets the minute-of-hour field.
getMonth()Gets the month-of-year field using the
Monthenum.intGets the month-of-year field from 1 to 12.
intgetNano()Gets the nano-of-second field.
Gets the zone offset, such as '+01:00'.
intGets the second-of-minute field.
intgetYear()inthashCode()A hash code for this date-time.
booleanChecks if the instant of this date-time is after that of the specified date-time.
booleanChecks if the instant of this date-time is before that of the specified date-time.
booleanChecks if the instant of this date-time is equal to that of the specified date-time.
booleanChecks if the specified field is supported.
booleanChecks if the specified unit is supported.
Returns a copy of this date-time with the specified amount subtracted.
Returns a copy of this date-time with the specified amount subtracted.
minusDays(long days) Returns a copy of this
OffsetDateTimewith the specified number of days subtracted.minusHours(long hours) Returns a copy of this
OffsetDateTimewith the specified number of hours subtracted.minusMinutes(long minutes) Returns a copy of this
OffsetDateTimewith the specified number of minutes subtracted.minusMonths(long months) Returns a copy of this
OffsetDateTimewith the specified number of months subtracted.minusNanos(long nanos) Returns a copy of this
OffsetDateTimewith the specified number of nanoseconds subtracted.minusSeconds(long seconds) Returns a copy of this
OffsetDateTimewith the specified number of seconds subtracted.minusWeeks(long weeks) Returns a copy of this
OffsetDateTimewith the specified number of weeks subtracted.minusYears(long years) Returns a copy of this
OffsetDateTimewith the specified number of years subtracted.now()Obtains the current date-time from the system clock in the default time-zone.
Obtains the current date-time from the specified clock.
Obtains the current date-time from the system clock in the specified time-zone.
of(int year, int month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond, ZoneOffset offset) Obtains an instance of
OffsetDateTimefrom a year, month, day, hour, minute, second, nanosecond and offset.Obtains an instance of
OffsetDateTimefrom a date, time and offset.Obtains an instance of
OffsetDateTimefrom a date-time and offset.Obtains an instance of
OffsetDateTimefrom anInstantand zone ID.Obtains an instance of
OffsetDateTimefrom a text string such as2007-12-03T10:15:30+01:00.Obtains an instance of
OffsetDateTimefrom a text string using a specific formatter.Returns a copy of this date-time with the specified amount added.
Returns a copy of this date-time with the specified amount added.
plusDays(long days) Returns a copy of this OffsetDateTime with the specified number of days added.
plusHours(long hours) Returns a copy of this
OffsetDateTimewith the specified number of hours added.plusMinutes(long minutes) Returns a copy of this
OffsetDateTimewith the specified number of minutes added.plusMonths(long months) Returns a copy of this
OffsetDateTimewith the specified number of months added.plusNanos(long nanos) Returns a copy of this
OffsetDateTimewith the specified number of nanoseconds added.plusSeconds(long seconds) Returns a copy of this
OffsetDateTimewith the specified number of seconds added.plusWeeks(long weeks) Returns a copy of this OffsetDateTime with the specified number of weeks added.
plusYears(long years) Returns a copy of this
OffsetDateTimewith the specified number of years added.<R> RQueries this date-time using the specified query.
Gets the range of valid values for the specified field.
Gets a comparator that compares two
OffsetDateTimeinstances based solely on the instant.longConverts this date-time to the number of seconds from the epoch of 1970-01-01T00:00:00Z.
Converts this date-time to an
Instant.Gets the
LocalDatepart of this date-time.Gets the
LocalDateTimepart of this date-time.Gets the
LocalTimepart of this date-time.Converts this date-time to an
OffsetTime.toString()Outputs this date-time as a
String, such as2007-12-03T10:15:30+01:00.Converts this date-time to a
ZonedDateTimeusing the offset as the zone ID.Returns a copy of this
OffsetDateTimewith the time truncated.longCalculates the amount of time until another date-time in terms of the specified unit.
Returns an adjusted copy of this date-time.
Returns a copy of this date-time with the specified field set to a new value.
withDayOfMonth(int dayOfMonth) Returns a copy of this
OffsetDateTimewith the day-of-month altered.withDayOfYear(int dayOfYear) Returns a copy of this
OffsetDateTimewith the day-of-year altered.withHour(int hour) Returns a copy of this
OffsetDateTimewith the hour-of-day altered.withMinute(int minute) Returns a copy of this
OffsetDateTimewith the minute-of-hour altered.withMonth(int month) Returns a copy of this
OffsetDateTimewith the month-of-year altered.withNano(int nanoOfSecond) Returns a copy of this
OffsetDateTimewith the nano-of-second altered.Returns a copy of this
OffsetDateTimewith the specified offset ensuring that the result is at the same instant.Returns a copy of this
OffsetDateTimewith the specified offset ensuring that the result has the same local date-time.withSecond(int second) Returns a copy of this
OffsetDateTimewith the second-of-minute altered.withYear(int year) Returns a copy of this
OffsetDateTimewith the year 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
-
-
Method Details
-
timeLineOrder
-
now
-
now
-
now
-
of
-
of
-
of
-
ofInstant
-
from
-
parse
-
parse
-
isSupported
-
isSupported
-
range
-
get
-
getLong
-
getOffset
-
withOffsetSameLocal
-
withOffsetSameInstant
-
toLocalDateTime
-
toLocalDate
-
getYear
-
getMonthValue
-
getMonth
-
getDayOfMonth
-
getDayOfYear
-
getDayOfWeek
-
toLocalTime
-
getHour
-
getMinute
-
getSecond
-
getNano
-
with
-
with
-
withYear
-
withMonth
-
withDayOfMonth
-
withDayOfYear
-
withHour
-
withMinute
-
withSecond
-
withNano
-
truncatedTo
-
plus
-
plus
-
plusYears
-
plusMonths
-
plusWeeks
-
plusDays
-
plusHours
-
plusMinutes
-
plusSeconds
-
plusNanos
-
minus
-
minus
-
minusYears
-
minusMonths
-
minusWeeks
-
minusDays
-
minusHours
-
minusMinutes
-
minusSeconds
-
minusNanos
-
query
-
adjustInto
-
until
-
format
-
atZoneSameInstant
-
atZoneSimilarLocal
-
toOffsetTime
-
toZonedDateTime
-
toInstant
-
toEpochSecond
-
compareTo
-
isAfter
-
isBefore
-
isEqual
-
equals
-
hashCode
-
toString
-