For some reason this is not working,
Announcements
For some reason this is not working,
Perfect! Thank you so much!
@IanSL ,
That was a division by zero issue - here is a different approach - this one should work
With(
{
_Calc: DateDiff(
CleanStartDate.SelectedDate + Time(
Value(CleanStartHour.Selected.Value),
Value(CleanStartMinute.Selected.Value),
0
),
CleanEndDate.SelectedDate + Time(
Value(CleanEndHour.Selected.Value),
Value(CleanEndMinute.Selected.Value),
0
),
TimeUnit.Minutes
)
},
With(
{
_Days: RoundDown(
_Calc / 1440,
0
),
_DayMins: Mod(
_Calc,
1440
)
},
With(
{
_Hours: RoundDown(
_DayMins / 60,
0
),
_Minutes: Mod(
_DayMins,
60
)
},
_Days & " Days " & _Hours & " Hours " & _Minutes & " Minutes"
)
)
)
If you simply want the minutes, then just use this
DateDiff(
CleanStartDate.SelectedDate + Time(
Value(CleanStartHour.Selected.Value),
Value(CleanStartMinute.Selected.Value),
0
),
CleanEndDate.SelectedDate + Time(
Value(CleanEndHour.Selected.Value),
Value(CleanEndMinute.Selected.Value),
0
),
TimeUnit.Minutes
)
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.
MVP (Business Applications) Visit my blog Practical Power Apps
If both dates & times are already properly formatted DateTime elements (like Now()) You can simply use DateDiff(datetime1,datetime2,TimeUnit.Minutes)
Hi @IanSL ,
Try this format
With(
{
_Days:
DateDiff(
CleanStartDate.SelectedDate +
Time(
Value(CleanStartHour.Selected.Value),
Value(CleanStartMinute.Selected.Value),
0
),
CleanEndDate.SelectedDate +
Time(
Value(CleanEndHour.Selected.Value),
Value(CleanEndMinute.Selected.Value),
0
),
TimeUnit.Minutes
) / 1440
},
With(
{
_Hours:
Mod(
_Days,
RoundDown(
_Days,
0
)
) * 24
},
"Days: " &
RoundDown(
_Days,
0
) & " Hours: " &
RoundDown(
_Hours,
0
) & " Minutes: " &
Mod(
_Hours,
RoundDown(
_Hours,
0
)
) * 60
)
)
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.
MVP (Business Applications) Visit my blog Practical Power Apps
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
mmbr1606
275
Super User 2025 Season 1