YearFrac(startDate, endDate, basis)

Calculates the fractional number of years elapsed between «startDate» and «endDate», based on various artificial year standards that are sometimes used with financial instruments and obligations. The result is always positive, with the result being the span between the lesser of the two dates and the greater of the two dates.

The «basis» parameter specifies the method used to measure the fractional portion of the year. The possible values for «basis» are as follows:

0 (or omitted) = US (NASD) 30/360
1 = actual/actual
2 = Actual/360
3 = Actual/365
4 = European 30/360

The function is implemented to match the results computed by Excel 2003 for dates after 1900.

«startDate» and «endDate» are numeric, representing the number of days elapsed since the date origin. If these are fractional (e.g., with a time component), they are truncated to an integer date. You can use the function MakeDate to create a date within an expression, or you can enter a single date into a definition or table cell when the number format for that variable is set to date.


For date ranges that do not span the date 29-Feb-1900 [sic], the results returned by Analytica's YearFrac match those of Excel. Analytica does not duplicate Excel's 29-Feb-1900 bug (Excel treats 1900 as a leap year, even though it was not).


YearFrac was introduced in Analytica 4.2.

See Also


You are not allowed to post comments.