/** * Returns a copy of this {@code ZonedDateTime} with the specified period in days subtracted. * <p> * This operates on the local time-line, * {@link LocalDateTime#minusDays(long) subtracting days} to the local date-time. * This is then converted back to a {@code ZonedDateTime}, using the zone ID * to obtain the offset. * <p> * When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, * then the offset will be retained if possible, otherwise the earlier offset will be used. * If in a gap, the local date-time will be adjusted forward by the length of the gap. * <p> * This instance is immutable and unaffected by this method call. * * @param days the days to subtract, may be negative * @return a {@code ZonedDateTime} based on this date-time with the days subtracted, not null * @throws DateTimeException if the result exceeds the supported date range */ public ZonedDateTime minusDays(long days) { return (days == Long.MIN_VALUE ? plusDays(Long.MAX_VALUE).plusDays(1) : plusDays(-days)); }
/** * Returns a copy of this {@code ZonedDateTime} with the specified period in days subtracted. * <p> * This operates on the local time-line, * {@link LocalDateTime#minusDays(long) subtracting days} to the local date-time. * This is then converted back to a {@code ZonedDateTime}, using the zone ID * to obtain the offset. * <p> * When converting back to {@code ZonedDateTime}, if the local date-time is in an overlap, * then the offset will be retained if possible, otherwise the earlier offset will be used. * If in a gap, the local date-time will be adjusted forward by the length of the gap. * <p> * This instance is immutable and unaffected by this method call. * * @param days the days to subtract, may be negative * @return a {@code ZonedDateTime} based on this date-time with the days subtracted, not null * @throws DateTimeException if the result exceeds the supported date range */ public ZonedDateTime minusDays(long days) { return (days == Long.MIN_VALUE ? plusDays(Long.MAX_VALUE).plusDays(1) : plusDays(-days)); }