cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ian-S
Frequent Visitor

DateDiff - Hours and Minutes

Hi all, 

I have 2 multi-choice boxes (not time pickers) with a 'Start Time' and 'End Time'.  Someone on here kindly helped me work out the hours between the selected times but I also need minutes....if possible.  

On the example below, I would like it to show minutes and hours e.g. 1.5 hour or 1.30  rather than just the hours

If(DataCardValue42.Selected.Value = "Work", DateDiff (
DateTimeValue (DataCardValue33.Selected.Value),
DateTimeValue (DataCardValue34.Selected.Value),
"hours"
))

 

MS_Help.JPG

 

Thank you in advance!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Ian-S :

The reason is that the unit you use when calculating is 'hours'. Just replace it with minutes and divide by 60.

Please try this formula:

 

If(DataCardValue42.Selected.Value = "Work", 
   DateDiff (
     DateTimeValue (DataCardValue33.Selected.Value),
     DateTimeValue (DataCardValue34.Selected.Value),
     Minutes
     )/60
   )

 

I think this link will help you a lot:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-dateadd-datediff

Best Regards,

Bof

View solution in original post

3 REPLIES 3
cds
Impactful Individual
Impactful Individual

(datediff(, hours) - RoundDown(datediff, hours))  * 60

this will give you min..

 

formula obvio not complete but you get the idea

Ian-S
Frequent Visitor

Thanks CDS.  I am not sure about the code???   (this is all very new to me).   Is the RoundDown(datediff, hours))  * 60 in addition to my existing code??

Sorry for being stupid! 

Hi @Ian-S :

The reason is that the unit you use when calculating is 'hours'. Just replace it with minutes and divide by 60.

Please try this formula:

 

If(DataCardValue42.Selected.Value = "Work", 
   DateDiff (
     DateTimeValue (DataCardValue33.Selected.Value),
     DateTimeValue (DataCardValue34.Selected.Value),
     Minutes
     )/60
   )

 

I think this link will help you a lot:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-dateadd-datediff

Best Regards,

Bof

View solution in original post

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,352)