 AdvanceDate - Maple Help

Finance

 advance a given date by the given number of time units Calling Sequence AdvanceDate(date, n, units, calendar, opts) AdvanceDate(n, units, calendar, opts) Parameters

 date - a string containing a date specification in a format recognized by ParseDate or a Date data structure n - integer; number of units units - Days, Weeks, Months, or Years; time units calendar - a name representing a supported calendar (e.g. Toronto, NewYork) or a calendar data structure created using the Calendar constructor opts - (optional) equation(s) of the form option = value where option is one of convention or output; specify options for the AdvanceDate command Options

 • The opts argument can contain one or more of the options shown below.
 • convention =  Unadjusted, Preceding, ModifiedPreceding, Following, ModifiedFollowing, or MonthEndReference -- Provide business day conventions; default value is Unadjusted. See AdjustDate for more details.
 • output = data or formatted -- Specify the type of output the AdvanceDate command should return. If this option is set to data (default) the record containing the data information will be returned. Otherwise the data will be formatted using the format deduced from the original date. Description

 • The AdvanceDate command advances a given date by the given number of time units. If the advanced date falls on a holiday according to the given calendar it will be adjusted to the appropriate business day with respect to the given convention.
 • The parameter date must be a date specified in any of the formats recognized by the ParseDate command. If this parameter is missing, the global evaluation date is used.
 • The parameter units specifies the time units in which the increment is measured. The number of units n can be either positive or negative.
 • The parameter calendar must be either a name representing a supported calendar (e.g. Toronto, NewYork) or a calendar data structure created using the Calendar constructor. Examples

 > $\mathrm{with}\left(\mathrm{Finance}\right):$
 > $\mathrm{AdvanceDate}\left("February 6, 2007",10,\mathrm{output}=\mathrm{formatted},\mathrm{convention}=\mathrm{Unadjusted}\right)$
 ${"February 16, 2007"}$ (1)
 > $\mathrm{AdvanceDate}\left("February 6, 2006",100,\mathrm{output}=\mathrm{formatted}\right)$
 ${"May 17, 2006"}$ (2)
 > $\mathrm{AdvanceDate}\left("February 6, 2006",1,\mathrm{Weeks},\mathrm{output}=\mathrm{formatted}\right)$
 ${"February 13, 2006"}$ (3)
 > $\mathrm{AdvanceDate}\left("February 6, 2006",1,\mathrm{Years},\mathrm{output}=\mathrm{formatted}\right)$
 ${"February 6, 2007"}$ (4)
 > $\mathrm{AdvanceDate}\left("February 6, 2006",-5,\mathrm{output}=\mathrm{formatted}\right)$
 ${"February 1, 2006"}$ (5)
 > $\mathrm{date}≔\mathrm{AdvanceDate}\left("February 6, 2006",-5,\mathrm{output}=\mathrm{data}\right)$
 ${\mathrm{date}}{≔}{"February 1, 2006"}$ (6)
 > ${\mathrm{date}}_{\mathrm{monthDay}}$
 ${1}$ (7)
 > ${\mathrm{date}}_{\mathrm{month}}$
 ${2}$ (8)
 > ${\mathrm{date}}_{\mathrm{year}}$
 ${2006}$ (9)

Note that last command returned a date data structure. It is printed as a string.

 > $\mathrm{lprint}\left(\mathrm{AdvanceDate}\left("February 6, 2006",-5,\mathrm{output}=\mathrm{data}\right)\right)$
 Record('monthDay' = 1, 'month' = 2, 'year' = 2006, 'format' = "%B %e, %Y", 'ModulePrint' = proc (m) Finance:-FormatDate(m) end proc) Compatibility

 • The Finance[AdvanceDate] command was introduced in Maple 15.