YearDiff

This function calculates number of full years between given dates. Return value is always positive, even if 'dateTo’ is greater than 'dateFrom’

Syntax

YearDiff("dateFrom","dateTo");

Function arguments

  • dateFrom – (String) The first date.
  • dateTo – (String) The second date.

Return value

This function returns Decimal. This function returns number of full years between two specified dates.

Examples

Example 1: This will return 0.

years = YearDiff(2015-01-02, 2015-01-02);

Example 2: This will return 1.

years = YearDiff(2015-01-02, 2016-01-02);

Example 3: This will return 0.

years = YearDiff(2015-01-02, 2016-01-01);

Example 4: This will return 2.

years = YearDiff(2015-04-05, 2017-06-15);

Example 5: This will return 5.

years = YearDiff(2015-04-05, 2010-04-05);