Financial Toolbox | ![]() ![]() |
Syntax
Months = months(StartDate, EndDate, EndMonthFlag
)
Description
Months = months(StartDate, EndDate,
returns the number of whole months between EndMonthFlag
)
StartDate
and EndDate
. If EndDate
is earlier than StartDate
, Months
is negative. Enter dates as serial date numbers or date strings.
StartDate
is an n-row character array of date strings, then EndDate
must be an n-row character array of date strings or a single date. Months
is then an n-by-1 vector of numbers.
Examples
Months = months('may 31 2000', 'jun 30 2000', 1) Months = 1 Months = months('may 31 2000','jun 30 2000', 0) Months=
0
Dates = ['mar 31 2002'; 'apr 30 2002'; 'may 31 2002']; Months = months(Dates, 'jun 30 2002') Months = 3 2 1
See Also
yearfrac
![]() | month | movavg | ![]() |