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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,899)