| Financial Toolbox | Search  Help Desk |
| yearfrac | Examples See Also |
Fraction of year between dates.
Syntax
f = yearfrac(d1, d2, basis) f = yearfrac(d1, d2)
Description
f = yearfrac(d1, d2, basis)
returns a fraction based on the number days between dates d1 and d2 using the given day-count basis. If d2 is earlier than d1, f is negative. Enter dates as serial date numbers or date strings.
basis is the day-count basis: 0 = actual/actual (default), 1 = 30/360,2 = actual/360, 3 = actual/365.
Examples
f = yearfrac('14 mar 97', '14 sep 97', 0)
f =
0.5041
f = yearfrac('14 mar 97', '14 sep 97', 1)
f =
0.5000
See Also
days360, days365, daysact, daysdif, months, wrkdydif, yeardays