Showing results for 
Search instead for 
Did you mean: 
Level: Powered On

How can I subtract time?

I would like to display in the text box the time subtracted the current time from the arrival time of the bus.

In excel, it can be displayed by finding the difference between two times but it is difficult to display with PowerApps.


Should I calculate using "TimeValue"?

I tried it, but I couldn't.


Does anyone know?


Re: How can I subtract time?

Hi riverhill,


Welcome to the PowerApps Community! I'll explain the method I took to create your situation:



  • tbxBusArrive - Text input control for changing the time the bus arrives
  • btnMyFunctions - Button for running much of our important logic
  • timTimer - Timer that shows the countdown clock

btnMyFunctions OnSelect method:

UpdateContext({varTimeBusArrive: Text(TimeValue(tbxBusArrive.Text), "[$-en-us]hh:mm:ss"), varTimeNow: Text(Now(), "[$-en-us]hh:mm:ss")});

UpdateContext({varTimerDuration: TimeValue(varTimeBusArrive) - TimeValue(varTimeNow)});


Note: you must separate the UpdateContext statements so the context variable changes can be fully processed so they are properly set for the next statement.


timTimer properties:


Duration: varTimerDuration

Text: Text(Time(0,0,0,varTimerDuration - Timer1.Value), "[$-en-us]hh:mm:ss")


The only part I haven't tackled is clearing the Timer1 Value, I haven't figured out how to do this yet, but you may not have to do this for your app.


Hope this helps! Let me know if anything needs clarifying.

Community Support Team
Community Support Team

Re: How can I subtract time?

Hi Riverhill,


Here is an article about “Show text and format dates and times in Microsoft PowerApps”, in this article, the section about “Calculate times based on hours, minutes, and seconds” could be a reference for you.


The link of the article is:


Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Level: Powered On

Re: How can I subtract time?

Thank you.I will try it!

PowerApps Staff Ryanmch
PowerApps Staff

Re: How can I subtract time?

To subtract time, you will need to calculate the amount of time to subtract in days then subtract that from the date/time value.




(DateTimeValue("1/13/2017 3:35 PM") - 5/60/24) - This will subtract 5 min from the date/time value (5 (min) divided by 60 (minutes per hour) divided by 24 (hours per day))


To get the difference of 2 date/time values in minutes, simply reverse the process:


(DateTimeValue("1/13/2017 3:35 PM") - DateTimeValue("1/13/2017 3:32:30 PM"))*24*60 - multiply by 24 (hours per day) and 60 (minutes per hour)


Ryan McHenry [MSFT - PowerApps]

Helpful resources


Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020


Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,917)