Function: YearFrac

Description

Calculates the fraction of the year represented by the number of whole days between two dates. For instance, you can use YearFrac to identify the proportion of a whole year's benefits, or obligations to assign to a specific term.

Syntax

YearFrac([start_date],[end_date],[basis]).

Arguments

start_date and end_date can be a constant, a date field, an expression that results in a date or a function that returns a date.

basis is optional and can have one of the following values:

Basis

Meaning

0 or blank

US (NASD) 30/360

1

actual/actual

2

actual/360

3

actual/365

4

European 30/360

 

Return value

This function returns a number.

Calculated field example

For the following dates:

Argument

Sample Value

Start_Date

1/1/2012

End_Date

7/30/2012

 

YearFrac([start_date],[end_date]) = 0.58055556

 

For the following dates:

Argument

Sample Value

Start_Date

1/1/2020

End_Date

7/1/2020

 

YearFrac([start_date],[end_date]) = 0.5000

(This indicates that 7/1/2020 is the midpoint, or 1/2,of the year 2020)

 

 

© 2024 Altair Engineering Inc. All Rights Reserved.

Intellectual Property Rights Notice | Technical Support