%% Determine the Dates of Days in a Future Month
% Determine the TargetDate in a future month using a date character vector for StartDate.

StartDate = '03-Jun-1997';
NumberMonths = 6;
DayFlag = 0;
Basis = 0;
EndMonthRule = 1;
 
TargetDate = datemnth(StartDate, NumberMonths, DayFlag,...
Basis, EndMonthRule)
datestr(TargetDate)

%
% Determine the TargetDate in a future month using a datetime array for StartDate.

Day = datemnth(datetime('3-jun-2001','Locale','en_US'), 6, 0, 0, 0)

%
% Determine the TargetDate in a future month using a vector for NumberMonths.

NumberMonths = [1; 3; 5; 7; 9];
TargetDate = datemnth('31-jan-2001', NumberMonths); 
datestr(TargetDate)

% Copyright 2012 The MathWorks, Inc.