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
Highlighted
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
Highlighted
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

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

PowerApps Staff CarlosFigueira
PowerApps 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
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 393 members 2,900 guests
Please welcome our newest community members: