minus method

  1. @useResult
ZonedDateTime minus({
  1. int years = 0,
  2. int months = 0,
  3. int days = 0,
  4. int hours = 0,
  5. int minutes = 0,
  6. int seconds = 0,
  7. int milliseconds = 0,
  8. int microseconds = 0,
})

Returns a copy of this with the units of time subtracted.

This function adds the conceptual units of time like -.

// DST occurs at 2023-03-12 02:00
// https://www.timeanddate.com/time/change/usa/detroit?year=2023

final datetime = ZonedDateTime('America/Detroit', 2023, 3, 12);

datetime.minus(days: 1);              // 2023-03-12T00:00-04:00[America/Detroit]
datetime.subtract(Duration(days: 1)); // 2023-03-11T23:00-04:00[America/Detroit]

Implementation

@useResult ZonedDateTime minus({int years = 0, int months = 0, int days = 0, int hours = 0, int minutes = 0, int seconds = 0, int milliseconds = 0, int microseconds = 0}) =>
    ZonedDateTime._convert(timezone, _native.minus(
      years: years,
      months: months,
      days: days,
      hours: hours,
      minutes: minutes,
      seconds: seconds,
      milliseconds: milliseconds,
      microseconds: microseconds,
    ));