Finance - Maple Help

Home : Support : Online Help : Mathematics : Finance : Date Arithmetic : Finance/NthWeekday

Finance

 NthWeekday
 advance to the nth given day of the given month

 Calling Sequence NthWeekday(n, weekday, month, year)

Parameters

 n - positive integer between 1 and 5; day number weekday - Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sun, Mon, Tue, Wed, Thu, Fri, Sat, or an integer between 1 and 7; weekday month - January, February, March, April, May, June, July, August, September, October, November, December, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec, or an integer between 1 and 12; month year - positive integer; year opts - (optional) equation(s) of the form option = value where option is output; specify options for the NthWeekday command

Options

 • output = data or formatted -- Specify the type of output the NthWeekday 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 formated using the format deduced from the original date.

Description

 • The NthWeekday command returns the first date that follows the given date and falls on the given day of the week. If the specified date already falls on the specified day of the week, the date itself will be returned.
 • The parameter n is the number of the weekday of interest. For example $n=1$ indicates the first weekday of the month, $n=2$ indicates the second weekday of the month, etc.
 • The parameter weekday is the weekday of interest. It can be given either as a name or as an integer between 1 and 7. In the latter case, 1 represents Sunday, 2 represents Monday, etc.
 • The parameter month is the month. It can be given either as a name or as an integer between 1 and 12. In the latter case, 1 represents January, 2 represents February, etc.
 • The parameter year is the year.

Examples

 > $\mathrm{with}\left(\mathrm{Finance}\right):$

Return 3rd Monday in December, 2008.

 > $\mathrm{NthWeekday}\left(3,\mathrm{Monday},\mathrm{December},2006,\mathrm{output}=\mathrm{formatted}\right)$
 ${"December 18, 2006"}$ (1)
 > $\mathrm{NthWeekday}\left(3,\mathrm{Monday},\mathrm{December},2006\right)$
 $\left[{18}{,}{12}{,}{2006}\right]$ (2)

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

 > $\mathrm{lprint}\left(\mathrm{NthWeekday}\left(3,\mathrm{Monday},\mathrm{December},2006\right)\right)$
 [18, 12, 2006]
 > $\mathrm{NthWeekday}\left(3,2,12,2006,\mathrm{output}=\mathrm{formatted}\right)$
 ${"December 18, 2006"}$ (3)

Compatibility

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