differenceInYears

Modified on Tue, 22 Aug 2023

Description

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

Syntax

differenceInYears(date1, date2)

Returns

Return ValueDescription
NumberReturn the number of full years between the given dates.

Sample

ExampleResultDescription
differenceInYears (1990-3-15, 2023-4-3)33This function calculates the number of full years between these two dates, March 15, 1990, and April 3, 2023, and returns 33 years.

To view all the Date functions, click here.

See Also