# Need Help Calculating Months Between Two Dates

Hello,
I could use some assistance with an automation , I’m trying to calculate the number of months between two dates (startDate and endDate).

Hey @Man, Welcome to the community.
You can get the count of the month using

And then you can simply subtract them

Thank you for your response @VinayakUpadhyay . This method cannot work in all cases. It is only valid when the start and end dates are within the same year. For instance, if the start date is 05/06/2022 and the end date is 05/06/2024, it cannot work.

yes @Man, You are right
If the year is different then we can do that in this way

By doing this you will get the desired result

blueprint (12).json (7.7 KB)

1 Like

thank you very much @VinayakUpadhyay I just have one last question and when I want to calculate the total number of months between these dates how should I do it

@Man, Check the above reply now

Thank u so much @VinayakUpadhyay it works

Make documentation has another way of doing this as well. Just adjust the calculation for which output you need.
https://www.make.com/en/help/functions/date---time-functions#how-to-calculate-days-between-dates

2 Likes

@Donald_Mitchell Amazing! That was a more optimized way of doing that.

1 Like

Yes, but I think there will be some edge cases that may not work out correctly/as expected.
There are different ways to interpret “Number of months between two dates”.
For example, is 1 month = 30 days? Therefore you need to determine the number of days then divide by 30? That won’t always work.
If both dates are in the same month does that need to return a difference of 0 months or 1 month?
Is a start date of 1/1/2024 and end date of 2/29/2024 considered a difference of 1 month or 2?

1 Like