cancel
Showing results for
Did you mean:
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"
))``````

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support

Hi @Ian-S :

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

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

Best Regards,

Bof

5 REPLIES 5
Impactful Individual

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

this will give you min..

formula obvio not complete but you get the idea

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!

Community Support

Hi @Ian-S :

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

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

Best Regards,

Bof

Regular Visitor

Credit for this has to Go to Shane Young - with this video - Power Apps Date Time Math - Do calculations for payroll and timesheets - YouTube

I used a field to collate both start time and minutes then end time and minutes and used the following:

With({minutesbetween:
DateDiff(TimeValue('Input - Start Time'.Text),TimeValue('Input - EndTime_2'.Text), Minutes) },
With({minutesleftover: Mod(minutesbetween, 60)},
(minutesbetween - minutesleftover)/60 & ":" &minutesleftover))

this will then give the number of hours difference in a time format e.g 7:25 minutes difference rather than 7.4444

Regular Visitor

Try the following code it should work:

In my case DateValue14. is the time out, DateValue13 is the time in

RoundDown(Text(DateDiff(DateValue14.SelectedDate+Time(Value(HourValue10.Selected.Value),Value(MinuteValue13.Selected.Value),0),DateValue15.SelectedDate+Time(Value(HourValue11.Selected.Value),Value(MinuteValue14.Selected.Value),0),TimeUnit.Minutes)/60),0)&" Hours : "&Mod(DateDiff(DateValue14.SelectedDate+Time(Value(HourValue10.Selected.Value),Value(MinuteValue13.Selected.Value),0),DateValue15.SelectedDate+Time(Value(HourValue11.Selected.Value),Value(MinuteValue14.Selected.Value),0),TimeUnit.Minutes),60)& " Minutes"

Good luck

Announcements

#### Take a short Community User Survey | Help us make your experience better!

To ensure that we are providing the best possible experience for Community members, we want to hear from you!    We value your feedback! As part of our commitment to enhancing your experience, we invite you to participate in a brief 15-question survey. Your insights will help us improve our services and better serve the community.   👉 Community User Survey    Thank you for being an essential part of our community!    Power Platform Engagement Team

#### Tuesday Tip | How to Get Community Support

It's time for another Tuesday Tip, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.       This Week: All About Community Support Whether you're a seasoned community veteran or just getting started, you may need a bit of help from time to time! If you need to share feedback with the Community Engagement team about the community or are looking for ways we can assist you with user groups, events, or something else, Community Support is the place to start.   Community Support is part of every one of our communities, accessible to all our community members.   Within each community's Community Support page, you'll find three distinct areas, each with a different focus to help you when you need support from us most. Power Apps: https://powerusers.microsoft.com/t5/Community-Support/ct-p/pa_community_support Power Automate: https://powerusers.microsoft.com/t5/Community-Support/ct-p/mpa_community_support Power Pages: https://powerusers.microsoft.com/t5/Community-Support/ct-p/mpp_community_support Copilot Studio: https://powerusers.microsoft.com/t5/Community-Support/ct-p/pva_community-support   Community Support Form If you need more assistance, you can reach out to the Community Team via the Community support form. Choose the type of support you require and fill in the form accordingly. We will respond to you promptly.    Thank you for being an active part of our community. Your contributions make a difference!   Best Regards, The Community Management Team

#### Calling all User Group Leaders and Super Users! Mark Your Calendars for the next Community Ambassador Call on May 9th!

This month's Community Ambassador call is on May 9th at 9a & 3p PDT. Please keep an eye out in your private messages and Teams channels for your invitation. There are lots of exciting updates coming to the Community, and we have some exclusive opportunities to share with you! As always, we'll also review regular updates for User Groups, Super Users, and share general information about what's going on in the Community.     Be sure to register & we hope to see all of you there!