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

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

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