datemnth
Date of day in future or past month
Syntax
Description
determines
a date in a future or past month based on movement either forward
or backward in time by a given number of months.TargetDate
= datemnth(StartDate
,NumberMonths
)
Any input can contain multiple values, but if so, all other
inputs must contain the same number of values or a single value that
applies to all. For example, if StartDate
is
an n-row character array of date character vectors,
then NumberMonths
must be an N
-by-1
vector
of integers or a single integer. TargetDate
is
then an N
-by-1
vector of date
numbers.
If StartDate
is a serial date number or
date character vector, TargetDate
is returned
as a serial date number. Use datestr
to
convert serial date numbers to formatted date character vectors.
If StartDate
is a datetime array, then TargetDate
is
returned as a datetime array.
determines
a date in a future or past month based on movement either forward
or backward in time by a given number of months, using optional input
arguments for TargetDate
= datemnth(___,DayFlag
,Basis
,EndMonthRule
)DayFlag
,Basis
,
and EndMonthRule
.