%% Add Years, Months, Days, or Time to a Date
% This example shows how to add a number of years, months, days, hours, minutes, seconds, or milliseconds to a date in serial date number format. For example, add 5 months to January 3, 2012:
% Convert the date string to serial date number format.

initialdate = datenum('03/01/2012','dd/mm/yyyy');

%
% Use the addtodate function to add 5 months to the initial date.

futuredate = addtodate(initialdate,5,'month')

%
% To convert the future date to a date string, use the datestr function.

datestr(futuredate, 'dddd, mmmm dd')

% Copyright 2015 The MathWorks, Inc.