%% Determine if Dates Occur Within Interval
% Define a lower bound and an upper bound for dates.

tlower = datetime(2014,05,16)

%

tupper = '23-May-2014'

% tlower and tupper can be datetime arrays or character vectors. Here, tlower is a datetime array and tupper is a single character vector.
%
% Create an array of datetime values and determine if each datetime lies within the interval bounded by tlower and  tupper.

t = tlower + caldays(2:2:10)

%

tf = isbetween(t,tlower,tupper)

% Copyright 2012 The MathWorks, Inc.