Financial Toolbox    
datemnth

Date of day in future or past month

Syntax

Arguments

StartDate
Enter as serial date numbers or date strings.
NumberMonths
Vector containing number of months in future (positive) or past (negative). Values must be in integer form.
DayFlag

(Optional) Vector containing values that specify how the actual day number for the target date in future or past month is determined. 0 (default) = day number should be the day in the future or past month corresponding to the actual day number of the start date. 1 = day number should be the first day of the future or past month. 2 = day number should be the last day of the future or past month.

This flag has no effect if EndMonthRule is set to 1.

Basis
(Optional) Day-count basis: 0 = actual/actual (default), 1 = 30/360, 2 = actual/360, 3 = actual/365.
EndMonthRule

(Optional) End-of-month rule. A vector. 1 = rule in effect, meaning that if you are beginning on the last day of a month, and the month has 30 or fewer days, you will end on the last actual day of the future or past month regardless of whether that month has 28, 29, 30 or 31 days)

0 = rule off (default), meaning that the rule is not in effect.

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 strings, 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.

Description

TargetDate = datemnth(StartDate, NumberMonths, DayFlag, Basis, EndMonthRule) returns the serial date number of the target date in the future or past.

Use datestr to convert serial date numbers to formatted date strings.

Examples

See Also

datestr, datevec, days360, days365, daysact, daysdif, wrkdydif


  datefind datenum