differenceInCalendarYears

Modified on Tue, 22 Aug 2023

Description

Use this function to get the number of calendar years between the given dates.

Syntax

differenceInCalendarYears(dateLeft, dateRight)

Returns

Return ValueDescription
NumberNumber of calendar years between the given dates.

Sample

ExampleResultDescription
differenceInCalendarYears (1995-1-1, 2023-4-1)28The differenceInCalendarYears function with these dates, which will return the number of calendar years between the two dates. In this example, the output will be 28.

To view all the Date functions, click here.

See Also