subtract method

Jiffy subtract({
  1. int microseconds = 0,
  2. int milliseconds = 0,
  3. int seconds = 0,
  4. int minutes = 0,
  5. int hours = 0,
  6. int days = 0,
  7. int weeks = 0,
  8. int months = 0,
  9. int years = 0,
})

Subtracts the date and time from the current Jiffy instance and returns a new Jiffy instance with the result.

The microseconds, milliseconds, seconds, minutes, hours, days, weeks, months, and years arguments allow you to specify subtractive time to subtract from the current Jiffy instance. These arguments are all optional and default to 0.

Example:

final jiffy = Jiffy.parse(
  '1997-09-23 13:37:00',
  pattern: 'yyyy-MM-dd HH:mm:ss'
);
final previousHour = jiffy.subtract(hours: 1);
print(previousHour.format('yyyy-MM-dd HH:mm:ss'));
// output: '1997-09-23 12:37:00'

Implementation

Jiffy subtract({
  int microseconds = 0,
  int milliseconds = 0,
  int seconds = 0,
  int minutes = 0,
  int hours = 0,
  int days = 0,
  int weeks = 0,
  int months = 0,
  int years = 0,
}) {
  final dateTime = _manipulator.subtract(this.dateTime, microseconds,
      milliseconds, seconds, minutes, hours, days, weeks, months, years);
  return _clone(dateTime);
}