Returns the fraction of a year represented by the number of whole days between two dates.

Namespace: Imsl.Finance
Assembly: ImslCS (in ImslCS.dll) Version: 6.5.0.0

Syntax

C#
public static double Yearfrac(
	DateTime startDate,
	DateTime endDate,
	DayCountBasis basis
)
Visual Basic (Declaration)
Public Shared Function Yearfrac ( _
	startDate As DateTime, _
	endDate As DateTime, _
	basis As DayCountBasis _
) As Double
Visual C++
public:
static double Yearfrac(
	DateTime startDate, 
	DateTime endDate, 
	DayCountBasis^ basis
)

Parameters

startDate
Type: System..::.DateTime
The DateTime start date of the security.
endDate
Type: System..::.DateTime
The DateTime end date of the security.
basis
Type: Imsl.Finance..::.DayCountBasis
A DayCountBasis object which contains the type of day count basis to use.

Return Value

A double which specifies the annual yield of a security that pays interest at maturity.

Remarks

It is computed using the following:

A/D
where A equals the number of days from start to end, D equals annual basis.

See Also