You are currently viewing PowerApps Timer Control full tutorial
Power Apps Timer

PowerApps Timer Control full tutorial

In this post, we will give a full tutorial about how PowerApps Timer Control work, we will learn how to set the PowerApps timer duration, how PowerApps start and stop the timer on a button click “Count up or Countdown”, and how to reset the PowerApps Timer Control.

What is PowerApps timer Control?

  • In PowerApps, Microsoft provides the timer control to determine how the app will respond after a certain amount of time has passed.
  • The timer duration tells how long the PowerApps timer will run in milliseconds.
  • By Default, the PowerApps timer duration is 60 seconds.
  • And the Max timer Duration is 24 hours expressed in milliseconds.

How to add the PowerApps Timer Control?

  1. Login to your Power Apps Make site with your credintials.
  2. Create canvas App from blank.
  3. Then add the PowerApps Timer Control, Go to Insert tab > Click on Input > Select Timer as shown below.
PowerApps Timer Control
PowerApps Timer Control

After adding the Timer control to your Power Apps Canvas app it will appear as shown below, with a default duration of 60000 milliseconds that represent 60 seconds, and you can increase it up to 24 hours.

Power Apps Timer Duration
Power Apps Timer Duration

By default if you run your Timer canvas app now and click on the timer it will start to count up to the the Timer duration that you present in the duration property of the timer control, also if you press again the timer button,it will stop, and so on whith every click on the timer it will change its status from start to stop and from stop to start.

So let’s know how to configure the Power Apps Timer control to fit your need.

PowerApps start timer on button click

Now I will show you how PowerApps start timer with variable.

  1. Insert an Icon or button for starting the PowerApps Timer control.
  2. I will use variables to hold the status if the timer “start or stop”, So if you will set the variable in the same screen, then you can use the context variable, but if you want to use the variable in onther screen you can use the global variables, for mor details you can check the diffrent between context and the global variable .
  3. So in the OnSelect Property of the start icon, set the formula to be as shown below
UpdateContext({startTimer1:false});UpdateContext({startTimer1:true});

you have to set the variable “StartTimer1” to be false first to work correctly when the last value of the variable is true to avoid the timer not starting status.

PowerApps start timer
PowerApps start timer with variable
  1. In the Start property of the timer control type the context variable name as shown below
start timer

This is how the PowerApps timer starts with variables.

PowerApps stop timer on button click

Now I will show you how PowerApps stop timer with a button click with variable.

  1. Insert an Icon or button to stop the PowerApps Timer control.
  2. In the OnSelect property of the stop icon/button write the bellow formula to pass the false value to the parameter that we created before.That means, Once you will hit the button, the timer will stop.
UpdateContext({startTimer1:false})
PowerApps stop timer on button click
PowerApps timer stop

PowerApps Reset timer control to zero

Now I will show you how PowerApps Reset the timer control.

  1. Insert an Icon or button to stop the PowerApps Timer control.
  2. In the OnSelect property of the Reset icon/button write the bellow formula to pass the Timer control to the Reset function.
PowerApps Reset timer control to zero
PowerApps Reset timer control to zero

PowerApps Timer control countdown

What if you want the Power Apps timer control to start counting down from the duration you specified in the duration property until it reaches 0 value. So you have to change the Text property of the Timer control to be as shown below, and it will start counting down from the timer duration to 0.

Text(Time(0, 0, (Timer.Duration-Timer.Value)/1000), "[$-en-US]hh:mm:ss")
ti6 | Power Platform Geeks

Now if you run your app and press the start button it will start counting down from the specified duration “60 seconds”.

How to set the PowerApps timer value?

As we mentioned before that the default duration is 60 seconds which represent in milliseconds and we set it in the duration property, but what if you want to set the PowerApps Timer value from a control on your app, to do these please follow the below steps.

  1. Insert textbox and button to set the timer value.
  2. in the ONSelect Property of the button that will set the Timer value write the formula below,
Reset(Timer);UpdateContext({timerVal:Value(TimeTextbox.Text)*60000});
  • Timer is the name of the Timer control
  • timerVal is a variable that use to set the timer value
ti7 1 | Power Platform Geeks
  1. In the duration property of the Timer control, write the variable name timerVal that hold the duration value.
timerVal

Conclusion

After reading this article, you learned how to use Timer control in Microsoft Power Apps, and learned

  • What is the PowerApps timer value?
  • What is the PowerApps timer duration?
  • How the PowerApps timer start?
  • How to PowerApps reset timer to zero?
  • How the PowerApps start timer on button click?
  • How the PowerApps start timer with variable?
  • Why the PowerApps timer not starting and how to solve it?
  • How to stop and reset the Timer?
  • How PowerApps timer countdown?

In some cases, when you will start the timer for the first time, it won’t work, that is why we should stop the timer first, and we solved this issue by passing the false value to the variable to set the timer to the stop status first, then pass the true value to start the variable, so it will work correctly.

See Also
Join us
Need Help
  • Have a related question? Please ask it at deBUG.to Community.

Heba Kamal

Microsoft MVP, MCT, Technical Speaker, Blogger, and Microsoft 365 and Power Platform Consultant.