differenceInMonths
Modified on Tue, 22 Aug 2023
Description
Use this function to get the number of full months between the given dates.
Syntax
differenceInMonths(date1, date2)
Returns
Return Value | Description |
---|---|
Number | Return the number of full months between the given dates. |
Sample
Example | Result | Description |
---|---|---|
differenceInMonths (2022-2-15, 2023-4-3) | 14 | In this example, date1 is February 15, 2022, and date2 is April 3, 2023. The differenceInMonths function returns 14, which is the number of full months between the two dates. |
To view all the Date functions, click here.
See Also
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article