3 Replies Latest reply: May 4, 2018 12:55 AM by Jonathan Dienst

# get month

If I have two dates 02/21/2017 & 01/26/2018, how could I get the number of months between these two dates?

• ###### Re: get month

Hi Wanyun,

You can use below expression to get number of months between these two dates.

=Round((date#(01/26/2018) - date#(02/21/2017))/30,0)

Regards,

Akshaya

PS - if you find this as correct/helpful, mark it as Correct/Helpful.

• ###### Re: get month

May be:

Interval(End_Date-Start_Date,'MM')

• ###### Re: get month

FLOOR(INTERVAL(DATE(DATE#('01/26/2018','MM/DD/YYYY'),'DD/MM/YYYY')-DATE(DATE#('02/21/2017','MM/DD/YYYY'),'DD/MM/YYYY'),'D hh:mm')/30)

• ###### Re: get month

I prefer to define a MonthSequence field in my master calendar.

...

Year(calDate) * 12 + Month(calDate) as MonthSequence,

...

In that case difference in months is simply the difference of the two month sequences.

If you want to do this in an expression, then you can do something similar

=(Year(date1) * 12 + Month(date1)) - (Year(date2) * 12 + Month(date2))