Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Fraction of year between dates

`YearFraction = yearfrac(StartDate,EndDate,Basis)`

returns a fraction, in years, based on the number of days between dates
`YearFraction`

= yearfrac(`StartDate`

,`EndDate`

,`Basis`

)`StartDate`

and `EndDate`

using the given
day-count `Basis`

.

The number of days in a year (365 or 366) is equal to the number of days in the
calendar year after the `StartDate`

. If
`EndDate`

is earlier than `StartDate`

,
`YearFraction`

is negative.

All specified arguments must be number of instruments
(`NUMINST`

-by-`1`

) or
(`1`

-by-`NUMINST`

) conforming vectors or
scalar arguments.

`date2time`

| `datetime`

| `days360`

| `days365`

| `daysact`

| `daysdif`

| `months`

| `wrkdydif`

| `year`

| `year`

| `yeardays`

| `yearfrac `