YEAR_FRACTION Function (PV-WAVE Advantage)
Evaluates the fraction of a year represented by the number of whole days between two dates.
Usage
result = YEAR_FRACTION(date_start, date_end, basis)
Input Parameters
date_start—Initial date. For a more detailed discussion on dates see Chapter 8, Working with Date/Time Data in the PV‑WAVE User’s Guide.
date_end—Ending date. For a more detailed discussion on dates see Chapter 8, Working with Date/Time Data in the PV‑WAVE User’s Guide.
basis—The method for computing the number of days between two dates. It should be 0, 1, 2, 3, or 4.
0—Actual/Actual
1—US (NASD) 30/360
2—Actual/360
3—Actual/365
4—European 30/360
Returned Value
result—The fraction of a year represented by the number of whole days between two dates. If no result can be computed, NaN is returned.
Input Keywords
Double—If present and nonzero, double precision is used.
Discussion
Function YEAR_FRACTION computes the fraction of the year.
It is computed using the following:
A/D
where A = the number of days from start to end, D = annual basis.
Example
In this example, YEAR_FRACTION computes the year fraction between August 1, 2000, and July 1, 2001, using the US (NASD) 30/360 day count method.
date_start = VAR_TO_DT(2000, 8, 1)
date_end = VAR_TO_DT(2001, 7, 1)
basis = 1
PRINT, YEAR_FRACTION(date_start, date_end, basis)
; PV-WAVE prints: 0.916667
Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.