yearsbetween(
yearsbetween(
STARTDATE
,
ENDDATE
)

The yearsbetween( function calculates the number of years between two dates.

Parameters

This function has two parameters:

startdate – the starting date (see the date( function.)

enddate – the ending date

Description

This function calculates the number of years between two dates, accounting for leap years.

    yearsbetween(date("1/1/98"),date("1/1/2005")) ☞ 7
    yearsbetween(date("1/2/98"),date("1/1/2005")) ☞ 6

Note: This function is equivalent to:

    yearvalue(enddate) - yearvalue(startdate) - ?(monthvalue(startdate) > monthvalue(enddate) or
        monthvalue(startdate)=monthvalue(enddate) and dayvalue(startdate) > dayvalue(enddate),1,0)

See Also

- age( -- calculates a person's current age (in years) from their birthdate.
- completedatestr( -- converts a date to text, spelling out the month and including the day of the week.
- Date Arithmetic Formulas -- performing calculations on dates, and converting between dates and text.
- Dates -- working with dates.
- datestr( -- converts a date to text using format *mm/dd/yy*.
- daystr( -- converts a date to the day of the week (for example *Sunday*).
- eurodatestr( -- converts a date to text in European format.
- longdatestr( -- converts a date to text by spelling out the month.
- Smart Dates -- keyboard entry of dates.
- years( -- converts a number of days into a number of years.

History

Version | Status | Notes
10.0 | No Change | Carried over from Panorama 6.0.