Method Reference: calendarDuration.calmonths

calendarDuration: X = calmonths (calD)

Calendar duration in months.

X = calmonths (calD) returns a numeric array with the number of months as represented in calD.

calmonths is also available as a function, in which case it performs the opposite conversion.

See also: calendarDuration.calyears, calendarDuration.calquarters, calendarDuration.calweeks, calendarDuration.caldays, calmonths

Source Code: calendarDuration

Example: 1

As a calendarDuration method, calmonths inverts the builder: it returns the whole span expressed as a number of months (years and months rolled together). Compare split, which instead decomposes the span into parts.

 d = calendarDuration (2, 3, 40)
d =
  calendarDuration

   2y 3mo 40d
 calmonths (d)
ans = 27