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"
))
Thank you in advance!
Solved! Go to Solution.
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
(datediff(, hours) - RoundDown(datediff, hours)) * 60
this will give you min..
formula obvio not complete but you get the idea
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
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
User | Count |
---|---|
121 | |
87 | |
87 | |
75 | |
66 |
User | Count |
---|---|
215 | |
180 | |
138 | |
96 | |
82 |