cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
WebPortal
Post Prodigy
Post Prodigy

How to calculate the difference in Hours of two date pickers in date/time format

I want to calculate the difference in Hours of two date pickers in date/time format:

 

WebPortal_0-1606083937103.png

 

 

So, the beggining is "Inicio" and the end is "Fim".

 

How to express:

Datediff(Inicio, Fim, Hours)?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @WebPortal ,

This should do it

DateDiff(
   (
      DateValue1.SelectedDate + 
      Time(
         Value(HourValue1.Selected.Value), 
         Value(MinuteValue1.Selected.Value), 
      0
      )
   ),
   (
      DateValue2.SelectedDate + 
      Time(
         Value(HourValue2.Selected.Value), 
         Value(MinuteValue2.Selected.Value), 
      0
      )
   ),
   Hours
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

1 REPLY 1
WarrenBelz
Super User
Super User

Hi @WebPortal ,

This should do it

DateDiff(
   (
      DateValue1.SelectedDate + 
      Time(
         Value(HourValue1.Selected.Value), 
         Value(MinuteValue1.Selected.Value), 
      0
      )
   ),
   (
      DateValue2.SelectedDate + 
      Time(
         Value(HourValue2.Selected.Value), 
         Value(MinuteValue2.Selected.Value), 
      0
      )
   ),
   Hours
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,933)