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

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Answered

Calculating Day difference Between Two Dates

(0) ShareShare
ReportReport
Posted on by 90

Good Day. Thank you for your interest.

We have a simple requirement where we need to calculate the difference in Days between two dates. I used a duration field and the end result is shown in (minutes)? For example, 1/24/2022 -to- 1/27/2022 = 3 (minutes)? I just need to be able to show the Difference in Days as a Whole Number. Kindly share and let me know if further clarification is needed. 

Then I created a Date and Time calculation field and the DiffinDays(Start Time, End Time) calculation results in error. 

"You can't set the value DiffInDays(crbdd_leavestarttime, crbdd_leaveendtime), which is of type integer, to type dateTime."

Best Regards, Sunny

Date-Difference-Calculation.PNG_2D00_928x656.png

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at
    RE: Calculating Day difference Between Two Dates

    Hi Sunny21,

    Yes, you need to create a calculated field. However, it's type should be whole number not Data and Time because DiffInDays() function's return type is whole number.

    Please refer to this doc:

     https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/define-calculated-fields?view=op-9-1#calculated-field-functions-syntax

    Test:

    I create a calculated field named Duration to calculate the difference in Start Time and End Time of Booking Journal entity.

    Snipaste_5F00_2022_2D00_02_2D00_01_5F00_11_2D00_29_2D00_17.png Snipaste_5F00_2022_2D00_02_2D00_01_5F00_11_2D00_33_2D00_36.png

    Result:

    Snipaste_5F00_2022_2D00_02_2D00_01_5F00_11_2D00_32_2D00_42.png

  • Sunny21 Profile Picture
    90 on at
    Calculating the Date Difference between two columns

    Good Day. Thank you for your interest.

    We have a simple requirement where we need to calculate the difference in Days between two dates. I used a duration field and the end result is shown in (minutes)? For example, 1/24/2022 -to- 1/27/2022 = 3 (minutes)? I just need to be able to show the Difference in Days as a Whole Number. Kindly share and let me know if further clarification is needed. 

    Then I created a Date and Time calculation field and the DiffinDays(Start Time, End Time) calculation results in error. 

    "You can't set the value DiffInDays(crbdd_leavestarttime, crbdd_leaveendtime), which is of type integer, to type dateTime."

    Best Regards, Sunny

    Date-Difference-Calculation.PNG_2D00_928x656.png

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 100 Super User 2025 Season 2

#2
Suresh Kulla Profile Picture

Suresh Kulla 72 Super User 2025 Season 2

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 59

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans