
Announcements
I have start date and end date with hours and minutes. I have a drop down that user can select a day shift and night shift. When I select day shift I can put on start date 8:00 and end date 16:00 and It will calculate total hrs 8. Then when I select night shift from the dropdown from 19:00 to 4:00 the total hours should be 8hrs. I appreciate master if you can help me on this. Thank you in advance.
Hi @Slickyworm ,
you can try this
If(
Dropdown.Selected.Value = "Day Shift",
DateDiff(StartTime, EndTime, Hours),
If(
EndTime < StartTime,
DateDiff(StartTime, DateAdd(EndTime, 1, Days), Hours),
DateDiff(StartTime, EndTime, Hours)
)
)For detailed instructions on these functions and how to use them in your app, please refer to the official Microsoft documentation for Power Apps:
DateDiff function in Power Apps
DateAdd, DateDiff, and TimeZoneOffset functions in Power Apps
If this solution helps with your app, please consider accepting it. 😊