/** * Returns a copy of this {@code OffsetDateTime} with the specified period in nanoseconds added. * <p> * This instance is immutable and unaffected by this method call. * * @param nanos the nanos to add, may be negative * @return an {@code OffsetDateTime} based on this date-time with the nanoseconds added, not null * @throws DateTimeException if the unit cannot be added to this type */ public OffsetDateTime plusNanos(long nanos) { return with(dateTime.plusNanos(nanos), offset); }
/** * Returns a copy of this {@code OffsetDateTime} with the specified period in hours added. * <p> * This instance is immutable and unaffected by this method call. * * @param hours the hours to add, may be negative * @return an {@code OffsetDateTime} based on this date-time with the hours added, not null * @throws DateTimeException if the result exceeds the supported date range */ public OffsetDateTime plusHours(long hours) { return with(dateTime.plusHours(hours), offset); }
/** * Returns a copy of this {@code OffsetDateTime} with the specified period in nanoseconds added. * <p> * This instance is immutable and unaffected by this method call. * * @param nanos the nanos to add, may be negative * @return an {@code OffsetDateTime} based on this date-time with the nanoseconds added, not null * @throws DateTimeException if the unit cannot be added to this type */ public OffsetDateTime plusNanos(long nanos) { return with(dateTime.plusNanos(nanos), offset); }
/** * Returns a copy of this {@code OffsetDateTime} with the specified period in minutes added. * <p> * This instance is immutable and unaffected by this method call. * * @param minutes the minutes to add, may be negative * @return an {@code OffsetDateTime} based on this date-time with the minutes added, not null * @throws DateTimeException if the result exceeds the supported date range */ public OffsetDateTime plusMinutes(long minutes) { return with(dateTime.plusMinutes(minutes), offset); }
/** * Returns a copy of this {@code OffsetDateTime} with the specified period in hours added. * <p> * This instance is immutable and unaffected by this method call. * * @param hours the hours to add, may be negative * @return an {@code OffsetDateTime} based on this date-time with the hours added, not null * @throws DateTimeException if the result exceeds the supported date range */ public OffsetDateTime plusHours(long hours) { return with(dateTime.plusHours(hours), offset); }
/** * Returns a copy of this {@code OffsetDateTime} with the specified period in seconds added. * <p> * This instance is immutable and unaffected by this method call. * * @param seconds the seconds to add, may be negative * @return an {@code OffsetDateTime} based on this date-time with the seconds added, not null * @throws DateTimeException if the result exceeds the supported date range */ public OffsetDateTime plusSeconds(long seconds) { return with(dateTime.plusSeconds(seconds), offset); }
/** * Returns a copy of this {@code OffsetDateTime} with the specified period in minutes added. * <p> * This instance is immutable and unaffected by this method call. * * @param minutes the minutes to add, may be negative * @return an {@code OffsetDateTime} based on this date-time with the minutes added, not null * @throws DateTimeException if the result exceeds the supported date range */ public OffsetDateTime plusMinutes(long minutes) { return with(dateTime.plusMinutes(minutes), offset); }
/** * Returns a copy of this {@code OffsetDateTime} with the specified period in seconds added. * <p> * This instance is immutable and unaffected by this method call. * * @param seconds the seconds to add, may be negative * @return an {@code OffsetDateTime} based on this date-time with the seconds added, not null * @throws DateTimeException if the result exceeds the supported date range */ public OffsetDateTime plusSeconds(long seconds) { return with(dateTime.plusSeconds(seconds), offset); }
/** * Returns a copy of this {@code OffsetDateTime} with the nano-of-second value altered. * <p> * The offset does not affect the calculation and will be the same in the result. * <p> * This instance is immutable and unaffected by this method call. * * @param nanoOfSecond the nano-of-second to set in the result, from 0 to 999,999,999 * @return an {@code OffsetDateTime} based on this date-time with the requested nanosecond, not null * @throws DateTimeException if the nanos value is invalid */ public OffsetDateTime withNano(int nanoOfSecond) { return with(dateTime.withNano(nanoOfSecond), offset); }
/** * Returns a copy of this {@code OffsetDateTime} with the hour-of-day value altered. * <p> * The offset does not affect the calculation and will be the same in the result. * <p> * This instance is immutable and unaffected by this method call. * * @param hour the hour-of-day to set in the result, from 0 to 23 * @return an {@code OffsetDateTime} based on this date-time with the requested hour, not null * @throws DateTimeException if the hour value is invalid */ public OffsetDateTime withHour(int hour) { return with(dateTime.withHour(hour), offset); }
/** * Returns a copy of this {@code OffsetDateTime} with the year altered. * The offset does not affect the calculation and will be the same in the result. * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. * <p> * This instance is immutable and unaffected by this method call. * * @param year the year to set in the result, from MIN_YEAR to MAX_YEAR * @return an {@code OffsetDateTime} based on this date-time with the requested year, not null * @throws DateTimeException if the year value is invalid */ public OffsetDateTime withYear(int year) { return with(dateTime.withYear(year), offset); }
/** * Returns a copy of this {@code OffsetDateTime} with the minute-of-hour value altered. * <p> * The offset does not affect the calculation and will be the same in the result. * <p> * This instance is immutable and unaffected by this method call. * * @param minute the minute-of-hour to set in the result, from 0 to 59 * @return an {@code OffsetDateTime} based on this date-time with the requested minute, not null * @throws DateTimeException if the minute value is invalid */ public OffsetDateTime withMinute(int minute) { return with(dateTime.withMinute(minute), offset); }
/** * Returns a copy of this {@code OffsetDateTime} with the day-of-month altered. * If the resulting {@code OffsetDateTime} is invalid, an exception is thrown. * The offset does not affect the calculation and will be the same in the result. * <p> * This instance is immutable and unaffected by this method call. * * @param dayOfMonth the day-of-month to set in the result, from 1 to 28-31 * @return an {@code OffsetDateTime} based on this date-time with the requested day, not null * @throws DateTimeException if the day-of-month value is invalid * @throws DateTimeException if the day-of-month is invalid for the month-year */ public OffsetDateTime withDayOfMonth(int dayOfMonth) { return with(dateTime.withDayOfMonth(dayOfMonth), offset); }
/** * Returns a copy of this {@code OffsetDateTime} with the second-of-minute value altered. * <p> * The offset does not affect the calculation and will be the same in the result. * <p> * This instance is immutable and unaffected by this method call. * * @param second the second-of-minute to set in the result, from 0 to 59 * @return an {@code OffsetDateTime} based on this date-time with the requested second, not null * @throws DateTimeException if the second value is invalid */ public OffsetDateTime withSecond(int second) { return with(dateTime.withSecond(second), offset); }
/** * Returns a copy of this {@code OffsetDateTime} with the second-of-minute value altered. * <p> * The offset does not affect the calculation and will be the same in the result. * <p> * This instance is immutable and unaffected by this method call. * * @param second the second-of-minute to set in the result, from 0 to 59 * @return an {@code OffsetDateTime} based on this date-time with the requested second, not null * @throws DateTimeException if the second value is invalid */ public OffsetDateTime withSecond(int second) { return with(dateTime.withSecond(second), offset); }
/** * Returns a copy of this {@code OffsetDateTime} with the nano-of-second value altered. * <p> * The offset does not affect the calculation and will be the same in the result. * <p> * This instance is immutable and unaffected by this method call. * * @param nanoOfSecond the nano-of-second to set in the result, from 0 to 999,999,999 * @return an {@code OffsetDateTime} based on this date-time with the requested nanosecond, not null * @throws DateTimeException if the nanos value is invalid */ public OffsetDateTime withNano(int nanoOfSecond) { return with(dateTime.withNano(nanoOfSecond), offset); }
/** * Returns a copy of this {@code OffsetDateTime} with the year altered. * The offset does not affect the calculation and will be the same in the result. * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. * <p> * This instance is immutable and unaffected by this method call. * * @param year the year to set in the result, from MIN_YEAR to MAX_YEAR * @return an {@code OffsetDateTime} based on this date-time with the requested year, not null * @throws DateTimeException if the year value is invalid */ public OffsetDateTime withYear(int year) { return with(dateTime.withYear(year), offset); }
/** * Returns a copy of this {@code OffsetDateTime} with the month-of-year altered. * The offset does not affect the calculation and will be the same in the result. * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. * <p> * This instance is immutable and unaffected by this method call. * * @param month the month-of-year to set in the result, from 1 (January) to 12 (December) * @return an {@code OffsetDateTime} based on this date-time with the requested month, not null * @throws DateTimeException if the month-of-year value is invalid */ public OffsetDateTime withMonth(int month) { return with(dateTime.withMonth(month), offset); }
/** * Returns a copy of this {@code OffsetDateTime} with the day-of-year altered. * If the resulting {@code OffsetDateTime} is invalid, an exception is thrown. * <p> * This instance is immutable and unaffected by this method call. * * @param dayOfYear the day-of-year to set in the result, from 1 to 365-366 * @return an {@code OffsetDateTime} based on this date with the requested day, not null * @throws DateTimeException if the day-of-year value is invalid * @throws DateTimeException if the day-of-year is invalid for the year */ public OffsetDateTime withDayOfYear(int dayOfYear) { return with(dateTime.withDayOfYear(dayOfYear), offset); }
/** * Returns a copy of this {@code OffsetDateTime} with the minute-of-hour value altered. * <p> * The offset does not affect the calculation and will be the same in the result. * <p> * This instance is immutable and unaffected by this method call. * * @param minute the minute-of-hour to set in the result, from 0 to 59 * @return an {@code OffsetDateTime} based on this date-time with the requested minute, not null * @throws DateTimeException if the minute value is invalid */ public OffsetDateTime withMinute(int minute) { return with(dateTime.withMinute(minute), offset); }