Create a datetime scalar representing November 1, 2013 at 8:00 AM.t1 = datetime(2013,11,1,8,0,0);Add a sequence of fixed-length hours to the datetime.t = t1 + hours(0:2)t = 1x3 datetime array
01-Nov-2013 08:00:00 01-Nov-2013 09:00:00 01-Nov-2013 10:00:00Add a sequence of calendar months to the datetime.t = t1 + calmonths(1:5)t = 1x5 datetime array
Columns 1 through 301-Dec-2013 08:00:00 01-Jan-2014 08:00:00 01-Feb-2014 08:00:00Columns 4 through 501-Mar-2014 08:00:00 01-Apr-2014 08:00:00Each datetime in t occurs on the first day of each month.Verify that the dates in t are spaced 1 month apart.dt = caldiff(t)dt = 1x4 calendarDuration array
1mo 1mo 1mo 1moDetermine the number of days between each date.dt = caldiff(t,'days')dt = 1x4 calendarDuration array
31d 31d 28d 31dAdd a number of calendar months to the date, January 31, 2014, to create a sequence of
dates that fall on the last day of each month.7 Dates and Time