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);
Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.