Choose where you’d like to start


Note: This task is applicable to all Zoho services except Zoho Creator.


The monthsDiff() function takes startDateTimeValue and endDateTimeValue as arguments. It returns the number of months between the given date-time values.

Note: The difference between monthsDiff function and monthsBetween function is that the monthsBetween function considers a month as 30 days. So, let's say the start date is specified as 01-Feb-2020 and the end date is specified as 01-Mar-2020, the monthsBetween function will return 0 (since the difference in days is less than 30). The monthsDiff function returns 1 in this case since this function considers a month depending on the number of days in it.

Return Type

  • Number


<variable> = <startDateTimeValue>.monthsDiff(<endDateTimeValue>);


<variable> = monthsDiff(<startDateTimeValue>,<endDateTimeValue>);
ParameterDescriptionData type
<variable>Variable which will contain the returned number.NUMBER

The starting date-time value.


The ending date-time value.


The time value is not taken into account while using this function.

Please refer this help document to learn about the supported date-time formats.


startDate = '31-Dec-1989';
endDate = '01-Jan-1990';
newEndDate = '01-Feb-1990';
numberOfMonths= monthsDiff(startDate, endDate);              // returns 0
numOfMonths = monthsDiff(startDate, newEndDate);           // returns 1
startDate = '01-Feb-2020';
endDate = '01-Mar-2020';
info monthsDiff(startDate, endDate);           // returns 1

Get Started Now