Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Get the number of years and months between two dates.

Featured Replies

Hi every one,

 

I need to calculate the number of years and months between two dates fields.

August31 = 8/31/2013

DOB = 9/1/2009

 

I need the calculation to show: 3Y 11M 

 

I appreciate any help.

Thanks

This calculation should do the trick:

 

 

Let([
     ElapsedYears=GetAsText(Year(SecondDate) - Year(FirstDate) - If(SecondDate <Date(Month(FirstDate); Day(FirstDate); Year(SecondDate)); 1; 0));
     ElapsedMonths = GetAsText(Mod(Month(SecondDate) - Month(FirstDate) + 12 - If(Day(SecondDate) < Day(FirstDate); 1; 0); 12))
];
If(FirstDate="";"";
ElapsedYears & " Y & " " & ElapsedMonths & " M")
)
 
I can't take credit for it; I found it in a custom function years ago.  Sorry I can't remember where, so I can't give proper credit.

Hi every one,

 

I need to calculate the number of years and months between two dates fields.

Also, look at the available Custom Functions at Brian Dunnings site here LINK and search for Elapse

  • Author

Thank you all for your help, this Works great for me.      :thankyou:

It depends on what you're using it for and how you define a "month".

 

Doug's example is okay, but you may consider January 29th, 2013 to February 28th, 2013 a month, while that calc doesn't.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.