Home > Expression Operators > Date Operators > #YEARDIF

#YEARDIF

Returns the number of years between two dates; the returned value may be fractional.

Syntax:

date1 #YEARDIF date2

Examples:

3/1/2018 #YEARDIF 3/1/1956 equals 62

10/1/1993 #YEARDIF 4/14/1978 equals 15.46448087

This operator is useful for service and age calculations. If the field DOH contains the value 2/4/1983 and the field DOB contains the value 7/16/1945, then DOH #YEARDIF DOB returns 37.55464481.

Details of calculation:

Each date is first converted to a decimal year using the equation:

image\ebx_-179859631.gif

* February is assumed to contain 29 days.

The decimal years are then subtracted.

Example:

 

 

image\ebx_1647615374.gif

 

 

Related Operators:

#MONTHDIF