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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Date Diff Calculation
Power Pages
Answered

Date Diff Calculation

(0) ShareShare
ReportReport
Posted on by 36

I have created a vacation request application for my office. I used the following command for date calculation, but when I select 5 days, the calculation box shows only 4 days. Can anyone help me correctly calculate the selected dates?

Code

DateDiff(DataCardValue66_1.SelectedDate, DataCardValue67_1.SelectedDate)
 
Result

 

If you'd like help with the date calculation code, feel free to share it, and I can assist in troubleshooting!

 

 

Categories:
I have the same question (0)
  • Verified answer
    TuongDoan Profile Picture
    573 Moderator on at
    DateDiff returns the difference from the start date to the end date, excluding the end date. So, the result is correct. If you want to include the end date, simply add +1 at the end of the formula
     
    ---------------------------
     |----- If the solution works, please kindly ✅ check the box "Does this answer your question?" 
     |----- This will help others in finding the solution more expediently 😄V
  • Suggested answer
    Inogic Profile Picture
    1,265 Moderator on at
    Hi,
     
    The DateDiff function calculates the days between the start and end dates, which excludes the start date itself from the count.

    To include both the start and end dates in your calculation, you can add 1 to the DateDiff function as below

    DateDiff(DataCardValue66_1.SelectedDate, DataCardValue67_1.SelectedDate) + 1

    Hope this helps.
     
    Thanks!
    Inogic Professional Services: Power Platform/Dynamics 365 CRM
    An expert technical extension for your techno-functional business needs
    Drop an email at crm@inogic.com 
    Service: https://www.inogic.com/services/ 
    Tips and Tricks: https://www.inogic.com/blog/ 
  • Verified answer
    SaiRT14 Profile Picture
    1,990 Super User 2025 Season 1 on at
    try this - DateDiff(DataCardValue66_1.SelectedDate, DataCardValue67_1.SelectedDate) + 1

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 Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
DP_Prabh Profile Picture

DP_Prabh 51

#2
rezarizvii Profile Picture

rezarizvii 35

#3
oliver.rodrigues Profile Picture

oliver.rodrigues 33 Most Valuable Professional

Last 30 days Overall leaderboard