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

Notifications

Announcements

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,135 Super User 2025 Season 2 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 2 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 78 Super User 2025 Season 2

#2
Jerry-IN Profile Picture

Jerry-IN 75

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard