Home > Expression Operators > Date Operators > #YEARDIF

#YEARDIF

Returns the number of years between two dates; the returned value may be fractional. The calculations differ between German mode and all other modes, and are described in separate sections below.

Syntax:

enddate #YEARDIF startdate

All modes other than German mode 

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_-429446250.gif

* February is assumed to contain 29 days.

The decimal years are then subtracted.

Example:

image/ebx_837833329.gif

German Mode

Examples:

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

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

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.5547570157.

Details of calculation:

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

4/14/1978 4/13/1993  15 years
4/14/1993 9/13/1993    5 months
9/14/1993 9/30/1993  17 days
10/1/1993 10/1/1993    1 day

 

 
 
 
 
 
 
 
 

 

Related Operators:

#MONTHDIF

To compute the number of days between two dates, use - (minus) instead, as in enddate - startdate.