cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jamarchi
Level: Powered On

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
Level 8

Re: Hours between dates

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
Level 8

Re: Hours between dates

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

Jamarchi
Level: Powered On

Re: Hours between dates

Hi hngdev

 

Excellent, it worked great, thank you very much

 

Regards,

hngdev
Level 8

Re: Hours between dates

You're welcome

Highlighted
Americo2018
Level: Powered On

Re: Hours between dates

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

Power Apps Staff CarlosFigueira
Power Apps Staff

Re: Hours between dates

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
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,505)