2007-12-03+01:00.
OffsetDate is an immutable date-time object that represents a date, often viewed
as year-month-day-offset. This object can also access other date fields such as
day-of-year, day-of-week and week-of-year.
This class does not store or represent a time.
For example, the value "2nd October 2007 +02:00" can be stored
in an OffsetDate.
This class must be treated as a value type. Do not synchronize, rely on the identity hash code or use the distinction between equals() and ==.
| Modifier and Type | Field and Description |
|---|---|
| private final LocalDate | date
The local date. |
| public static final OffsetDate | MAX
The maximum supported |
| public static final OffsetDate | MIN
The minimum supported |
| private final ZoneOffset | offset
The offset from UTC/Greenwich. |
| private static final long | SECONDS_PER_DAY
The number of seconds per day. |
| private static final long | serialVersionUID
Serialization version. |
| Access | Constructor and Description |
|---|---|
| private | OffsetDate(LocalDate
the local date, not null date, ZoneOffset the zone offset, not null offset)Constructor. |
| Modifier and Type | Method and Description |
|---|---|
| public Temporal | Returns: the adjusted object, not nullthe target object to be adjusted, not null temporal)Implements java. Adjusts the specified temporal object to have the same offset and date as this object. |
| public OffsetDateTime | |
| public int | Returns: the comparator value, negative if less, positive if greaterthe other date to compare to, not null other)Implements java. Compares this |
| public boolean | Returns: true if this is equal to the other datethe object to check, null returns false obj)Overrides java. Checks if this date is equal to another date. |
| public String | Returns: the formatted date string, not nullthe formatter to use, not null formatter)Formats this date using the specified formatter. |
| public static OffsetDate | Returns: the offset date, not nullthe temporal object to convert, not null temporal)Obtains an instance of |
| public int | Returns: the value for the fieldthe field to get, not null field)Overrides default java. Gets the value of the specified field from this date as an |
| public int | |
| public DayOfWeek | Returns: the day-of-week, not nullGets the day-of-week field, which is an enum |
| public int | Returns: the day-of-year, from 1 to 365, or 366 in a leap yearGets the day-of-year field. |
| public long | Returns: the value for the fieldthe field to get, not null field)Implements java. Gets the value of the specified field from this date as a |
| public Month | |
| public int | |
| public ZoneOffset | |
| public int | |
| public int | Returns: a suitable hash codeOverrides java. A hash code for this date. |
| public boolean | Returns: true if this is after the instant of the specified datethe other date to compare to, not null other)Checks if the instant of midnight at the start of this |
| public boolean | Returns: true if this is before the instant of the specified datethe other date to compare to, not null other)Checks if the instant of midnight at the start of this |
| public boolean | Returns: true if the instant equals the instant of the specified datethe other date to compare to, not null other)Checks if the instant of midnight at the start of this |
| public boolean | Returns: true if the field is supported on this date, false if notthe field to check, null returns false field)Implements java. Checks if the specified field is supported. |
| public boolean | Returns: true if the unit can be added/subtracted, false if notthe unit to check, null returns false unit)Implements java. Checks if the specified unit is supported. |
| public OffsetDate | Returns: anOffsetDate based on this date with the subtraction made, not nullthe amount to subtract, not null amountToSubtract)Overrides default java. Returns a copy of this date with the specified amount subtracted. |
| public OffsetDate | Returns: anOffsetDate based on this date with the specified amount subtracted, not nullthe amount of the unit to subtract from the result, may be negative amountToSubtract, TemporalUnit the unit of the amount to subtract, not null unit)Overrides default java. Returns a copy of this date with the specified amount subtracted. |
| public OffsetDate | Returns: anOffsetDate based on this date with the days subtracted, not nullthe days to subtract, may be negative days)Returns a copy of this |
| public OffsetDate | Returns: anOffsetDate based on this date with the months subtracted, not nullthe months to subtract, may be negative months)Returns a copy of this |
| public OffsetDate | Returns: anOffsetDate based on this date with the weeks subtracted, not nullthe weeks to subtract, may be negative weeks)Returns a copy of this |
| public OffsetDate | Returns: anOffsetDate based on this date with the years subtracted, not nullthe years to subtract, may be negative years)Returns a copy of this |
| public static OffsetDate | Returns: the current date using the system clock, not nullObtains the current date from the system clock in the default time-zone. |
| public static OffsetDate | |
| public static OffsetDate | |
| public static OffsetDate | Returns: the offset date, not nullthe local date, not null date, ZoneOffset the zone offset, not null offset)Obtains an instance of |
| public static OffsetDate | Returns: the offset date, not nullthe year to represent, from MIN_YEAR to MAX_YEAR year, int the month-of-year to represent, from 1 (January) to 12 (December) month, int the day-of-month to represent, from 1 to 31 dayOfMonth, ZoneOffset the zone offset, not null offset)Obtains an instance of |
| public static OffsetDate | Returns: the offset time, not nullthe instant to create the time from, not null instant, ZoneId the time-zone, which may be an offset, not null zone)Obtains an instance of This creates an offset date with the same instant as midnight at the start of day of the instant specified. |
| public static OffsetDate | Returns: the parsed offset date, not nullthe text to parse such as "2007-12-03+01:00", not null text)Obtains an instance of |
| public static OffsetDate | Returns: the parsed offset date, not nullthe text to parse, not null text, DateTimeFormatter the formatter to use, not null formatter)Obtains an instance of |
| public OffsetDate | Returns: anOffsetDate based on this date with the addition made, not nullthe amount to add, not null amountToAdd)Overrides default java. Returns a copy of this date with the specified period added. |
| public OffsetDate | Returns: anOffsetDate based on this date with the specified amount added, not nullthe amount of the unit to add to the result, may be negative amountToAdd, TemporalUnit the unit of the amount to add, not null unit)Implements java. Returns a copy of this date with the specified amount added. |
| public OffsetDate | Returns: anOffsetDate based on this date with the days added, not nullthe days to add, may be negative days)Returns a copy of this |
| public OffsetDate | Returns: anOffsetDate based on this date with the months added, not nullthe months to add, may be negative months)Returns a copy of this |
| public OffsetDate | Returns: anOffsetDate based on this date with the weeks added, not nullthe weeks to add, may be negative weeks)Returns a copy of this |
| public OffsetDate | Returns: anOffsetDate based on this date with the years added, not nullthe years to add, may be negative years)Returns a copy of this |
| public < the type of the result R> R | Returns: the query result, null may be returned (defined by the query)the query to invoke, not null query)Overrides default java. Queries this date using the specified query. |
| public ValueRange | Returns: the range of valid values for the field, not nullthe field to query the range for, not null field)Overrides default java. Gets the range of valid values for the specified field. |
| private Object | |
| private long | Returns: the epoch seconds valueConverts this date to midnight at the start of day in epoch seconds. |
| public long | Returns: the number of seconds since the epoch of 1970-01-01T00:00:00Z, may be negativethe local time, not null time)Converts this |
| public LocalDate | |
| public String | Returns: a string representation of this date, not nullOverrides java. Outputs this date as a |
| public long | Returns: the amount of time between this date and the end datethe end time, exclusive, which is converted to an endExclusive, TemporalUnit OffsetDate, not nullthe unit to measure the amount in, not null unit)Implements java. Calculates the period between this date and another date in terms of the specified unit. |
| private OffsetDate | with(LocalDate
the date to create with, not null date, ZoneOffset the zone offset to create with, not null offset)Returns a new date based on this one, returning |
| public OffsetDate | Returns: anOffsetDate based on this with the adjustment made, not nullthe adjuster to use, not null adjuster)Overrides default java. Returns an adjusted copy of this date. |
| public OffsetDate | Returns: anOffsetDate based on this with the specified field set, not nullthe field to set in the result, not null field, long the new value of the field in the result newValue)Implements java. Returns a copy of this date with the specified field set to a new value. |
| public OffsetDate | Returns: anOffsetDate based on this date with the requested day, not nullthe day-of-month to set in the result, from 1 to 28-31 dayOfMonth)Returns a copy of this |
| public OffsetDate | Returns: anOffsetDate based on this date with the requested day, not nullthe day-of-year to set in the result, from 1 to 365-366 dayOfYear)Returns a copy of this |
| public OffsetDate | Returns: anOffsetDate based on this date with the requested month, not nullthe month-of-year to set in the result, from 1 (January) to 12 (December) month)Returns a copy of this |
| public OffsetDate | Returns: anOffsetDate based on this date with the requested offset, not nullthe zone offset to change to, not null offset)Returns a copy of this |
| public OffsetDate | Returns: anOffsetDate based on this date with the requested year, not nullthe year to set in the result, from MIN_YEAR to MAX_YEAR year)Returns a copy of this |