# YEARFRAC

The following section describes the syntax and usage of the **YEARFRAC** function in ActivityInfo.

## Description

The **YEARFRAC** function is used to obtain the length of time between two dates. The function calculates the fraction of the year represented by the number of whole days between two dates using the US 30/360 method.

## Syntax

**YEARFRAC**(startDate,endDate)

Argument | Required | Description |
---|---|---|

startDate | Yes | The first date to measure from.The value must be a Date. |

endDate |
Yes | The second date to measure to.The value must be a Date. |

## Result

The length of time from **startDate** to **endDate**, given as a fraction of a year.

## Example

We will be using the **YEARFRAC** function to find the distance between a set of dates and today (as a fraction of a year), and using the TODAY function to get the current date to measure to.

### Arguments

We will be using the Date field "Dates" (with code "dates") as our first argument **startDate**, and the **TODAY** function as our second argument **endDate**.

### Formula

YEARFRAC(dates,TODAY())

### Results

To use a specific date in the Formula, use the format "Date(2019,12,31))". So this example would be "YEARFRAC(dates,Date(2019,12,31))".