| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Financial Toolbox |
| Contents | Index |
| Learn more about Financial Toolbox |
YearFraction = yearfrac(StartDate, EndDate, Basis)
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.
|
All specified arguments must be number of instruments (NUMINST)-by-1 or 1-by-NUMINST conforming vectors or scalar arguments.
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.
YearFraction = yearfrac('14 mar 01', '14 sep 01', 0)
YearFraction =
0.5041
YearFraction = yearfrac('14 mar 01', '14 sep 01', 1)
YearFraction =
0.5000
days360, days365, daysact, daysdif, months, wrkdydif, year, yeardays
![]() | yeardays | ylddisc | ![]() |
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 |