Functions to determine the months between two dates and for the years separately

3 posts / 0 new
Last post
ortizmario6025@...
Offline
Joined: 09/03/2021 - 11:54
Functions to determine the months between two dates and for the years separately

month and years elapsed between two dates?2021-10-20 - 2018-09-30 =? Years2021-10-20 - 2018-09-30 =? month

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

You don't mentioned how detailed you want this to be.  For the year is it just the years or are you interested in partial years?  If it is just years it is simple:

@year(Date1) - @year(Date2) 

In your case it would be 3.

For the month are you just interested in the month?  If so replace the @year for @month and you will get the result.  If you want to include the years as months then you would have to also use the @year and multiple by 12 plus a bit of logic for the first and last years.

ortizmario6025@...
Offline
Joined: 09/03/2021 - 11:54

Thanks