YearFraction - Maple Help

Finance

 YearFraction
 return the interval between two dates as a fraction of the year

 Calling Sequence YearFraction(todate, daycounter) YearFraction(fromdate, todate, daycounter)

Parameters

 fromdate - a string containing a date specification in a format recognized by ParseDate or a Date data structure; first date todate - a string containing a date specification in a format recognized by ParseDate or a Date data structure; second date daycounter - (optional) day counter or the name of a day counting convention

Description

 • The YearFraction command returns the period between fromdate and todate as a fraction of the year calculated according to the day counting convention specified by daycounter. If no day counter is specified, the default one will be used.
 • See DayCounter or CalendarsAndDayCounters for a detailed description of the supported day count conventions and additional examples.

Examples

 > $\mathrm{with}\left(\mathrm{Finance}\right):$
 > $\mathrm{YearFraction}\left("Dec-20-2005","Nov-05-2006"\right)$
 ${0.8767123288}$ (1)
 > $\mathrm{YearFraction}\left("Dec-20-2005","Nov-05-2006",\mathrm{ISMA}\right)$
 ${0.9166666667}$ (2)
 > $\mathrm{YearFraction}\left("Dec-20-2005","Nov-05-2006",\mathrm{Simple}\right)$
 ${0.8750000000}$ (3)
 > $\mathrm{YearFraction}\left("Dec-20-2005","Nov-05-2006",\mathrm{OneDay}\right)$
 ${1.}$ (4)
 > $\mathrm{DC}≔\mathrm{Finance}:-\mathrm{DayCounter}\left(\mathrm{OneDay}\right):$
 > $\mathrm{YearFraction}\left("Dec-20-2005","Nov-05-2006",\mathrm{DC}\right)$
 ${1.}$ (5)
 > $\mathrm{SetEvaluationDate}\left("November 17, 2006"\right):$
 > $\mathrm{EvaluationDate}\left(\right)$
 ${"November 17, 2006"}$ (6)
 > $\mathrm{YearFraction}\left("December 01, 2007","December 01, 2008"\right)$
 ${1.000232053}$ (7)
 > $\mathrm{YearFraction}\left("December 01, 2007","December 01, 2008",\mathrm{Thirty360European}\right)$
 ${1.}$ (8)
 > $\mathrm{YearFraction}\left("December 01, 2008"\right)$
 ${2.038588218}$ (9)
 > $\mathrm{YearFraction}\left("December 01, 2008",\mathrm{Thirty360European}\right)$
 ${2.038888889}$ (10)

Compatibility

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