cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jamarchi
Advocate II
Advocate II

Hours between dates

Hi

 

It is possible calculate hours between dates? I could calculate days between dates

2016-07-14_12-32-32.png

1 ACCEPTED SOLUTION

Accepted Solutions
hngdev
Resolver II
Resolver II

Assume that you already had validation, you can try this:

DateDiff(DateTimeValue(TextBox1.Text), DateTimeValue(TextBox2.Text)) * 24 + Hour(DateTimeValue(TextBox1.Text)) -   Hour(DateTimeValue(TextBox2.Text))

View solution in original post

5 REPLIES 5
hngdev
Resolver II
Resolver II

Assume that you already had validation, you can try this:

DateDiff(DateTimeValue(TextBox1.Text), DateTimeValue(TextBox2.Text)) * 24 + Hour(DateTimeValue(TextBox1.Text)) -   Hour(DateTimeValue(TextBox2.Text))

View solution in original post

Hi hngdev

 

Excellent, it worked great, thank you very much

 

Regards,

You're welcome

Hi

 

Your code may be usefull for me if is there a way to exclude weekends and holidays, How could I get that?

 

Regadrs

Americo

The post at https://blogs.msdn.microsoft.com/carlosfigueira/2017/09/23/excluding-weekends-and-holidays-in-date-d... shows how to exclude weekends and holidays from date differences in PowerApps. Take a look and see how it can apply to your case.

 

Hope this helps!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,218)