%% Determine the Number of Whole Months Between Dates
% Find the number of whole months using date character vectors.

MyMonths = months('may 31 2000', 'jun 30 2000', 1)

%
% Find the number of whole months using date character vectors when the optional EndMonthFlag = 0.

MyMonths = months('may 31 2000','jun 30 2000', 0)

%
% Find the number of whole months using a cell array of date character vectors.

Dates = ['mar 31 2002'; 'apr 30 2002'; 'may 31 2002'];
MyMonths = months(Dates, 'jun 30 2002')

% Copyright 2012 The MathWorks, Inc.