This topic describes the syntax and usage of the yearsBetween function in Zoho Creator.
The yearsBetween function returns a number in the range (1 - ) representing the number of years between the given start and end dates.
The yearsBetween function syntax has the following arguments.
start_date - Required. The starting date. Dates should be entered by using the DATEVALUE function, or as results of other formulas or functions.
end_date - Required. The end date. Dates should be entered by using the DATEVALUE function, or as results of other formulas or functions.
Note: This function is supported only in free-flow scripting mode of Script Builder.
a. In this example, the date format specified in the application settings page is dd-MMM-yyyy. The date returned by dateValue(start_date) function is 20-May-2013 and dateValue(end_date) function is 20-June-2015. The yearsBetween function returns 2.
start_date = "05-20-13";
end_date = "06-20-15"
dat1 = dateValue(start_date);
dat2 = dateValue(end_date);
yearsBetween = yearsBetween(dat1,dat2);