%% Shift Dates to Specific Day of Week
% Shift an array of dates forward to the next Friday.

t = datetime([2014,08,03;2014,04,15])

%

t2 = dateshift(t,'dayofweek','Friday')

%
% Shift the array of dates backward to the previous Monday.

t2 = dateshift(t,'dayofweek','Monday','previous')

% Copyright 2015 The MathWorks, Inc.