Offset Date Time
A date and time of day with an offset from UTC.
OffsetDateTime is intended to be used primarily for use cases involving persistence or network transfer where the application of time zone rules may be undesirable. For most applications, ZonedDateTime is a better choice since it takes time zone rules into account when performing calendrical calculations.
Parameters
the local date and time of day
the offset from UTC
Throws
if the offset is invalid
Constructors
Creates an OffsetDateTime.
Creates an OffsetDateTime.
Creates an OffsetDateTime.
Creates an OffsetDateTime.
Creates an OffsetDateTime by combining a DateTime and UtcOffset.
Types
Functions
Returns this date-time with a new UTC offset, adjusting the date and time components such that the instant represented by it remains the same.
Returns a copy of this date-time with the values of any individual components replaced by the new values specified.
Checks if this time point represents the same instant as other. Unlike the equals operator, equality is determined solely by timeline order.
Returns this date-time with centuries subtracted from it.
Returns this date-time with days subtracted from it.
Returns this date-time with decades subtracted from it.
Returns this date-time with hours subtracted from it.
Returns this date-time with microseconds subtracted from it.
Returns this date-time with milliseconds subtracted from it.
Returns this date-time with minutes subtracted from it.
Returns this date-time with months subtracted from it.
Returns this date-time with nanoseconds subtracted from it.
Returns this date-time with period subtracted from it.
Returns this date-time with seconds subtracted from it.
Returns this date-time with weeks subtracted from it.
Returns this date-time with years subtracted from it.
Returns this date-time with duration subtracted from it.
Returns this date-tme with centuries added to it.
Returns this date-time with days added to it.
Returns this date-time with decades added to it.
Returns this date-time with hours added to it.
Returns this date-time with microseconds added to it.
Returns this date-time with milliseconds added to it.
Returns this date-time with minutes added to it.
Returns this date-time with months added to it.
Returns this date-time with nanoseconds added to it.
Returns this date-time with period added to it.
Returns this date-time with seconds added to it.
Returns this date-time with weeks added to it.
Returns this date-time with years added to it.
Returns this date-time with duration added to it.
Properties
The number of additional nanoseconds on top of secondsSinceUnixEpoch.
Extensions
Converts this OffsetDateTime to an equivalent ZonedDateTime using a fixed-offset time zone.
The date-time at the last representable instant of the month that this date-time falls in.
The date-time at the last representable instant of the ISO week that this date-time falls in.
The date-time at the last representable instant of the week that this date-time falls in. The first day of the week will be determined by the user's system settings. This may differ from the first day of the week associated with the default locale on platforms that allow the user to customize this.
The date-time at the last representable instant of the week that this date-time falls in. The first day of the week will be determined by locale.
The date-time at the last representable instant of the year that this date-time falls in.
Checks if this date-time falls within February 29.
Checks if this date-time falls within a leap year.
The length of this date-time's month in days.
The length of the ISO week-based year that this date-time falls in, either 52 or 53 weeks.
The length of this date-time's year in days.
The next date-time that falls on dayOfWeek, or this date-time if it falls on the same day.
The previous date-time that falls on dayOfWeek, or this date-time if it falls on the same day.
Returns this date-time, rounded down to match the precision of a given unit.
Returns this date-time, rounded down to the nearest hour that satisfies the increment.
Returns this date-time, rounded down to the nearest minute that satisfies the increment.
Returns this date-time, rounded down to the nearest second that satisfies the increment.
Returns this date-time, rounded down to the nearest millisecond that satisfies the increment.
Returns this date-time, rounded down to the nearest microsecond that satisfies the increment.
Returns this date-time, rounded down to the nearest nanosecond that satisfies the increment.
Returns this date-time, rounded to the nearest hour that satisfies the increment. If the time is halfway between increments, it will be rounded up.
Returns this date-time, rounded to the nearest minute that satisfies the increment. If the time is halfway between increments, it will be rounded up.
Returns this date-time, rounded to the nearest second that satisfies the increment. If the time is halfway between increments, it will be rounded up.
Returns this date-time, rounded to the nearest millisecond that satisfies the increment. If the time is halfway between increments, it will be rounded up.
Returns this date-time, rounded to the nearest microsecond that satisfies the increment. If the time is halfway between increments, it will be rounded up.
Returns this date-time, rounded to the nearest nanosecond that satisfies the increment. If the time is halfway between increments, it will be rounded up.
Returns this date-time, rounded up to match the precision of a given unit.
Returns this date-time, rounded up to the nearest hour that satisfies the increment.
Returns this date-time, rounded up to the nearest minute that satisfies the increment.
Returns this date-time, rounded up to the nearest second that satisfies the increment.
Returns this date-time, rounded up to the nearest millisecond that satisfies the increment.
Returns this date-time, rounded up to the nearest microsecond that satisfies the increment.
Returns this date-time, rounded up to the nearest nanosecond that satisfies the increment.
The date-time at the first instant of the month that this date-time falls in.
The date-time at the first instant of the ISO week that this date-time falls in.
The date-time at the first instant of the week that this date-time falls in. The first day of the week will be determined by the user's system settings. This may differ from the first day of the week associated with the default locale on platforms that allow the user to customize this.
The date-time at the first instant of the week that this date-time falls in. The first day of the week will be determined by locale.
The date-time at the first instant of the year that this date-time falls in.
Converts this date-time to an equivalent Java OffsetDateTime.
Converts this date-time to an equivalent NSDateComponents object.
Returns the combined time and UTC offset.
Returns this date-time with the precision reduced to the year.
Returns this date-time with the precision reduced to the month.
Converts this OffsetDateTime to a ZonedDateTime using the specified strategy to adjust it to a valid date, time, and offset in zone.
Returns this date-time, rounded down to match the precision of a given unit.
Creates an OffsetDateTimeInterval from this date-time up to, but not including to.
The interval defining the ISO week that this date-time falls within.
The interval defining the week that this date-time falls within. The first day of the week will be determined by the provided settings.
The interval defining the week that this date-time falls within. The first day of the week will be the default associated with the provided locale.
The week-based year used in the ISO week date system. This value differs from the regular ISO year when the week number falls in the preceding or following year.
The week-based year, calculated using the week definition in settings. This value differs from the regular ISO year when the week number falls in the preceding or following year.
The week-based year, calculated using the week definition associated with the provided locale. This value differs from the regular ISO year when the week number falls in the preceding or following year.
The week number used in the ISO week date system.
The week number of the week-based year, calculated using the week definition in settings.
The week number of the week-based year, calculated using the week definition associated with the provided locale.
The week of the year, calculated using the ISO week definition. If the week number is associated with the preceding year, 0 will be returned.
The week of the year, calculated using the week definition in settings. If the week number is associated with the preceding year, 0 will be returned.
The week of the year, calculated using the week definition associated with the provided locale. If the week number is associated with the preceding year, 0 will be returned.