create new calendar - Maple Help

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

Finance[Calendar] - create new calendar

 Calling Sequence Calendar(name)

Parameters

 name - string or name; calendar type

Description

 • The Calendar command creates a calendar of the specified type and returns a module representing the new calendar. This data structure can be manipulated using the AddHoliday, JoinBusinessDays, JoinHolidays, and RemoveHoliday commands, and can also be used as a parameter to other commands from the Finance package.
 • The parameter name is the type of the calendar. At present only Western-style calendars are supported. This includes Bratislava, Budapest, Copenhagen, Frankfurt, Helsinki, Milan, Johannesburg, London, Oslo, Prague, Stockholm, Sydney, Tokyo, Toronto, NewYork, Warsaw, Wellington and Zurich.
 • In addition, two special calendars can be created: Null and Simple. Holidays in the Simple calendar are Saturdays, Sundays, and January 1st. The Null calendar does not have any holidays. Other calendars can be constructed using Null or Simple calendars as a base.

Examples

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

Create a sample calendar and modify it.

 > $C:=\mathrm{Calendar}\left(\mathrm{NewYork}\right):$
 > $\mathrm{IsHoliday}\left("December 26, 2006",C\right)$
 ${\mathrm{false}}$ (1)
 > $\mathrm{IsBusinessDay}\left("December 26, 2006",C\right)$
 ${\mathrm{true}}$ (2)
 > $\mathrm{AdvanceDate}\left("December 24, 2006",5,\mathrm{Days},C,\mathrm{output}=\mathrm{formatted}\right)$
 ${"January 2, 2007"}$ (3)

Here is a Beijing calendar for the year 2004.

 > $\mathrm{C2}:=\mathrm{Calendar}\left(\mathrm{Simple}\right):$
 > $\mathrm{NewYearDay}:=\mathrm{seq}\left(\mathrm{AdvanceDate}\left("January 1, 2004",i\right),i=0..6\right):$
 > $\mathrm{SpringFestival}:=\mathrm{seq}\left(\mathrm{AdvanceDate}\left("January 22, 2004",i\right),i=0..6\right):$
 > $\mathrm{LaborDay}:=\mathrm{seq}\left(\mathrm{AdvanceDate}\left("May 1, 2004",i\right),i=0..6\right):$
 > $\mathrm{NationalDay}:=\mathrm{seq}\left(\mathrm{AdvanceDate}\left("October 1, 2004",i\right),i=0..6\right):$
 > $\mathrm{AddHoliday}\left(\mathrm{C2},\left[\mathrm{NewYearDay},\mathrm{SpringFestival},\mathrm{LaborDay},\mathrm{NationalDay}\right]\right):$
 > $\mathrm{AdjustDate}\left("January 23, 2004",\mathrm{C2},\mathrm{convention}=\mathrm{Following},\mathrm{output}=\mathrm{formatted}\right)$
 ${"January 29, 2004"}$ (4)
 > $\mathrm{AdjustDate}\left("January 23, 2004",\mathrm{C2},\mathrm{convention}=\mathrm{Preceding},\mathrm{output}=\mathrm{formatted}\right)$
 ${"January 21, 2004"}$ (5)

This calendar can be joined with the New York calendar.

 > $\mathrm{C3}:=\mathrm{JoinBusinessDays}\left(C,\mathrm{C2}\right)$
 ${\mathrm{C3}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (6)
 > $\mathrm{C4}:=\mathrm{JoinHolidays}\left(C,\mathrm{C2}\right)$
 ${\mathrm{C4}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (7)
 > $\mathrm{IsHoliday}\left("January 23, 2004",C\right)$
 ${\mathrm{false}}$ (8)
 > $\mathrm{IsHoliday}\left("January 23, 2004",\mathrm{C2}\right)$
 ${\mathrm{true}}$ (9)
 > $\mathrm{IsHoliday}\left("January 23, 2004",\mathrm{C3}\right)$
 ${\mathrm{false}}$ (10)
 > $\mathrm{IsHoliday}\left("January 23, 2004",\mathrm{C4}\right)$
 ${\mathrm{true}}$ (11)