Subtract1.0.0+

  1. moment().subtract(Number, String);
  2. moment().subtract(Duration);
  3. moment().subtract(Object);

Mutates the original moment by subtracting time.

This is exactly the same as moment#add, only instead of adding time, it subtracts time.

  1. moment().subtract(7, 'days');

Before version 2.8.0, the moment#subtract(String, Number) syntax was also supported. It has been deprecated in favor of moment#subtract(Number, String).

  1. moment().subtract('seconds', 1); // Deprecated in 2.8.0
  2. moment().subtract(1, 'seconds');

As of 2.12.0 when decimal values are passed for days and months, they are rounded to the nearest integer.Weeks, quarters, and years are converted to days or months, and then rounded to the nearest integer.

  1. moment().subtract(1.5, 'months') == moment().subtract(2, 'months')
  2. moment().subtract(.7, 'years') == moment().subtract(8, 'months') //.7*12 = 8.4, rounded to 8

Note that in order to make the operations moment.add(-.5, 'days') and moment.subtract(.5, 'days') equivalent, -.5, -1.5, -2.5, etc are rounded down.