web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Calculate date difference into Month and Days

(0) ShareShare
ReportReport
Posted on by 1,243

Hi,

I would like to display 2 dates differences into month and days, e.g. 2 month 15 days. It seem standard calculated field is unable to achieve this, as the diffindays is calculate the total day in difference between the 2 dates.

In excel, we can use DATEDIF(A1,B1,"M") & "month ," &DATEDIF(A1,B1,"MD") & "days" it would return the desire result. How to achieve this ?

Thanks.

Regards,
Teh

I have the same question (0)
  • Suggested answer
    Emily Zhang Profile Picture
    Microsoft Employee on at

    I guess there's no oob function to achieve this. But you can write your own plugin.

    1. Register the plugin on record creation and update.

    2. Retrieve these 2 datetime attributes in plugin.

    3. Define 2 DateTime variable in the plugin, set datetime equals to attributes datetime.

    4. Compare month, days difference referring below document.

    docs.microsoft.com/.../system.datetime.month

    5. Pass the comparing difference back to CRM.

    But there's one issue with displaying 2 dates differences into month and days. For example: date1 is Jan 15th, date2 is March 3. If we compare date difference  into month and days, it will be come 2 month -12 days.

    If  you don't want negative number, then you need to make assumption, say every month is 30 days.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 214 Super User 2026 Season 1

#2
CU11031447-0 Profile Picture

CU11031447-0 100

#3
NeerajPawar Profile Picture

NeerajPawar 76

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans