subtract method

LocalDate subtract(
  1. Period period
)

Subtracts the specified period from this date. Fluent alternative to operator-().

  • period: The period to subtract. Must not contain any (non-zero) time units.

Returns: The result of subtracting the given period from this date.

Implementation

LocalDate subtract(Period period) {
  Preconditions.checkNotNull(period, 'period');
  Preconditions.checkArgument(!period.hasTimeComponent, 'period', "Cannot subtract a period with a time component from a date");
  return IPeriod.addDateTo(period, this, -1);
}