When using Power Apps, you might need to find the time difference between two dates or times. This could include calculating hours and minutes, using text inputs, or figuring out working hours excluding weekends.
In this tutorial, I will discuss the Power Apps DateDiff() function, how to calculate the time difference in Power Apps, and many more topics like:
- How to calculate time difference in hours in Power Apps
- Power Apps calculate time difference in minutes
- Calculate time difference in hours & minutes using Power Apps text inputs
- Power Apps calculate working hours between two dates, excluding weekends
DateDiff() in Power Apps
Power Apps DateDiff() is a function that helps you find the difference between two dates or times. It tells you how much time is between a start date and an end date, and you can choose whether you want the difference in days, hours, minutes, or other units.
Power Apps DateDiff() Syntax:
DateDiff( StartDateTime, EndDateTime [, Units ] )
- StartDateTime: The first date or time.
- EndDateTime: The second date or time.
- Units: The type of difference you want to calculate, like Days, Hours, Minutes, Seconds, etc.
How to Use Power Apps DateDiff() Function
Let’s say you want to find out how many days are between July 1, 2025, and July 10, 2025. You can use the code below on a Label’s Text property:
DateDiff(
DateValue("2025-07-01"),
DateValue("2025-07-10"),
TimeUnit.Days
)
This will return 9, because there are 9 days between those two dates.
Rather than entering the start and end dates manually, we can use Date Picker controls to select them.

Calculate Time Difference in Power Apps
Let’s see how to calculate and display the time differences in both hours and minutes using Power Apps Date pickers.
In the app, there are two Date Picker controls that allow the user to select a Start Date and an End Date. There are also four dropdowns for selecting the Start and End Hours and Minutes.
Now, I want to calculate the time difference between these two dates and times. You can see this in the screenshot below.

To achieve this, insert a Label control and apply the following formula on its Text property:
Text = DateDiff(
DtStartDate.SelectedDate + Time(
Value(DDHour1.Selected.Value),
Value(DDMin1.Selected.Value),
0
),
DtEndDate.SelectedDate + Time(
Value(DDHour2.Selected.Value),
Value(DDMin2.Selected.Value),
0
),
TimeUnit.Hours
) & ":" & Mod(
DateDiff(
DtStartDate.SelectedDate + Time(
Value(DDHour1.Selected.Value),
Value(DDMin1.Selected.Value),
0
),
DtEndDate.SelectedDate + Time(
Value(DDHour2.Selected.Value),
Value(DDMin2.Selected.Value),
0
),
TimeUnit.Minutes
),
60
)
Where,
- DateDiff = Power Apps DateDiff() is a type of function that returns the difference between two date/time values, and the output is a whole number of units.
- DtStartDate = Date picker control name for the Start Date
- DtEndDate = Date picker control name for the End Date
- DDHour1 = Dropdown Hour control name for the Start Date
- DDMin1 = Dropdown Minute control name for the Start Date
- DDHour2 = Dropdown Hour control name for the End Date
- DDMin2 = Dropdown Minute control name for the End Date
- TimeUnit.Hours = This function returns the hour component of a date and time value, ranging from 0 (12:00 AM) to 23 (11:00 PM).
- TimeUnit.Minutes = This function returns the minute component of a Date/Time value, ranging from 0 to 59.

Save and Preview the. Select the Start Date and End Date, including the Hour and Minute. Then, the time difference result will be shown in the label control.
Calculate Time Difference in Hours & Minutes in Power Apps
Next, we will calculate the time difference between hours and minutes.
Calculate Time Difference in Hours in Power Apps
In the screenshot below, you’ll see two-time fields, called Purchase Start Time and Purchase End Time, displayed in a Power Apps Edit form. These fields are single lines of text and come from a SharePoint list named Book Purchase Info.
Now, I want to calculate the difference in hours between the Purchase Start Time and Purchase End Time.

To work around this, insert a Label control and apply the below code on its Text property as:
Text = "Result: " & DateDiff(
DateTimeValue(DataCardValue10.Text),
DateTimeValue(DataCardValue11.Text),
TimeUnit.Hours
)
Where,
- “Result: ” = It is a string that will display in the label control
- DateTimeValue = PowerApps DateTimeValue is a function that helps to convert a date and time string (for example, “December 19, 2021, 12:31 PM”) to a date/time value.
- DataCardValue10 = Purchase Start Time Data Card Name
- DataCardValue11 = Purchase End Time Data Card Name

Save and preview the app. Enter the time (like 09:15) in both the time fields and the result (only Hours) in the label control.
Calculate Time Difference in Minutes in Power Apps
Next, we will calculate the time difference in only minutes between the Purchase Start Time and Purchase End Time fields.
To do so, select the label control and set its Text property to the code below:
Text = "Result: " & DateDiff(
DateTimeValue(DataCardValue10.Text),
DateTimeValue(DataCardValue11.Text),
TimeUnit.Minutes
)
Refer to the screenshot below.

Save and preview the app. Enter the time (like 16:15) in both fields, and you’ll see the result (in minutes) displayed in the label control.
Calculate Time Difference in Hours & Minutes Using Power Apps Text Input
In this example, I used just two text input fields and a label control in the app. When a user types the time into the two input fields, the result appears in the label control.
To do so, select the label control and set its Text property as: // For Hours Only
Text = DateDiff(
DateTimeValue(TextInput1.Text),
DateTimeValue(TextInput2.Text),
TimeUnit.Hours
)
Where,
TextInput1, TextInput2 = Text input control names

Save and preview the app. When you enter the time in both text fields, the result will be displayed in the label control, as shown in the above screenshot.
Similarly, if you want to calculate only the minutes, you can also use the Split function to achieve this. Apply the below code on the Label’s Text property: // For Minutes Only
DateDiff(
Time(
Value(
First(
Split(
txtStartMinute.Text,
":"
)
).Value
),
Value(
Last(
Split(
txtStartMinute.Text,
":"
)
).Value
),
0
),
Time(
Value(
First(
Split(
txtEndMinute.Text,
":"
)
).Value
),
Value(
Last(
Split(
txtEndMinute.Text,
":"
)
).Value
),
0
),
TimeUnit.Minutes
) & " Minutes"
Where,
- txtStartMinute = Text input name for start minute
- txtEndMinute = Text input name for end minute
Refer to the screenshot below.

This way, we can calculate the time difference in hours and minutes using the Power Apps text input values.
Calculate Working Hours Between Two Dates (Exclude Weekends) in Power Apps
To calculate working hours between two dates in Power Apps, excluding weekends (Saturday & Sunday), follow the instructions below:
Let’s assume a standard workday is 8 hours. I’ve added two Date Picker controls: Start Date and End Date. When a user picks a start and end date, the app calculates the total working hours between those dates, excluding weekends, as shown below.

To achieve this, paste the code below on a Label’s Text property:
With(
{
startDate: DateTimeValue(dtStartDate.SelectedDate),
endDate: DateTimeValue(dtEndDate.SelectedDate),
dailyHours: 8
},
With(
{
totalDays: DateDiff(
startDate,
endDate,
TimeUnit.Days
) + 1,
weekdays: CountIf(
Sequence(
DateDiff(
startDate,
endDate,
TimeUnit.Days
) + 1,
0,
1
),
Weekday(
DateAdd(
startDate,
Value,
TimeUnit.Days
)
) <> 1 && Weekday(
DateAdd(
startDate,
Value,
TimeUnit.Days
)
) <> 7
)
},
weekdays * dailyHours
)
) & " Hours"
Where,
- Sequence(…) creates a list of days between start and end.
- Weekday(…) checks the day of the week.
- 1 = Sunday, 7 = Saturday (U.S. format)
- We CountIf only on weekdays and multiply by 8 hours.
I hope this guide has helped you understand Power Apps DateDiff(), how to calculate time differences in Power Apps, whether it’s in hours and minutes, using text inputs, or finding working hours between dates that exclude weekends. Also, give them a try in your projects and see how easy it is to work with time in Power Apps!
Additionally, you may like some more Power Apps articles:
- Create a Responsive Navigation Menu in Power Apps
- Switch Light Or Dark Theme Color Using Power Apps Toggle
- Power Apps Horizontal Navigation Menu Component With Submenu
- Display Only Office 365 Active Users In Power Apps Combo Box

Hey! I’m Bijay Kumar, founder of SPGuides.com and a Microsoft Business Applications MVP (Power Automate, Power Apps). I launched this site in 2020 because I truly enjoy working with SharePoint, Power Platform, and SharePoint Framework (SPFx), and wanted to share that passion through step-by-step tutorials, guides, and training videos. My mission is to help you learn these technologies so you can utilize SharePoint, enhance productivity, and potentially build business solutions along the way.
Grams to Kgs,Pounds, Coverted Formula is possible
Actually I need Power apps IN examples: grams to kgs ,kg to pounds converted formula need
In the calculate business day parts, How i can get the holidays from Sharepoint’s list and load into “OnSelect” part?
what about differentiating nigth hours from day hours from the 2 day pickers? How can it be coded?