Method Reference: calendarDuration.minus

calendarDuration: C = minus (A, B)

Subtraction for calendarDuration arrays.

C = minus (A, B) is the equivalent of the syntax C = A - B and returns the result of subtracting the corresponding elements of B from those of A. C is a calendarDuration array of the same size as the input arguments after the necessary (if required) expansion. A and B must be size compatible, which translates to they can be the same size, one can be scalar, or for every dimension, their dimension sizes must be equal or one of them must be 1.

Either A or B may also be a duration or a numeric array with the latter representing duration days and being internally converted to a duration array with the days () function.

Source Code: calendarDuration

Example: 1

minus (-) subtracts one calendar duration from another.

 a = calyears (2) + calmonths (2)
a =
  calendarDuration

   2y 2mo
 a - calmonths (5)
ans =
  calendarDuration

   1y 9mo