Products & Services Solutions Academia Support User Community Company

Learn more about Financial Toolbox   

yearfrac - Fraction of year between dates

Syntax

YearFraction = yearfrac(StartDate, EndDate, Basis) 

Arguments

StartDate

Enter as serial date numbers or date strings.

EndDate

Enter as serial date numbers or date strings.

Basis

(Optional) Day-count basis of the instrument. A vector of integers.

  • 0 = actual/actual (default)

  • 1 = 30/360 (SIA)

  • 2 = actual/360

  • 3 = actual/365

  • 4 = 30/360 (PSA)

  • 5 = 30/360 (ISDA)

  • 6 = 30/360 (European)

  • 7 = actual/365 (Japanese)

  • 8 = actual/actual (ISMA)

  • 9 = actual/360 (ISMA)

  • 10 = actual/365 (ISMA)

  • 11 = 30/360E (ISMA)

  • 12 = actual/365 (ISDA)

  • 13 = BUS/252

All specified arguments must be number of instruments (NUMINST)-by-1 or 1-by-NUMINST conforming vectors or scalar arguments.

Description

YearFraction = yearfrac(StartDate, EndDate, Basis) returns a fraction based on the number of days between dates StartDate and EndDate using the given day-count basis. If EndDate is earlier than StartDate, Fraction is negative.

Examples

YearFraction = yearfrac('14 mar 01', '14 sep 01', 0)

YearFraction =

    0.5041

YearFraction = yearfrac('14 mar 01', '14 sep 01', 1)

YearFraction =

    0.5000

See Also

days360, days365, daysact, daysdif, months, wrkdydif, year, yeardays

  


Free Interactive Computational Finance CD

View demos and recorded presentations led by industry experts.

Now On Demand
Network with industry peers and learn the latest applications of the leading software product for computational finance.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS