Stopwatch or Countdown Timer

I need to display a countdown timer as well as a stopwatch at the press of a button. How could I go about incorporating that functionality?


You can set up a loop on the global canvas that sets e.g. a timeNow app variable to the current moment every 1 seconds with the NOW() function, then loops back through a Delay node to run the Set app variable function again.

Then, when you start your timer, you would record a timeStarted page variable again with NOW(), and bind your timer display to a formula like

DATETIME_DIFFERENCE(pageVars.timeStarted, appVars.timeNow, "seconds")

Of course, the loop can also be within the button component logic, with a IF condition node for pageVars.timerRunning boolean deciding if the loop should be continued or stopped.


This is helpful, thank you.

My only question is how did you get the second component (timerRunning = !timerRunning) to display the way that you did? It won’t let me enter the “!” if I try to create a new variable called “!timerRunning”

This is what my flow is currently showing:

Ideally, I’d like it to start the counting process when the button is tapped, and stop the counting process when the button is tapped again.

Any help is greatly appreciated, I understand this is an old thread but I still thought I’d ask.

Thank you!

I think I figured it out by using the NOT() function to set the durRunning variable to its opposite value. I also changed the connectors around to match yours. Probably not the most efficient way of doing this but let me know if there are any other ways to go about doing it.

Hi! The timerRunning = !timerRunning was only the name Harri had given to the flow function Set page variable. There he used the formula !pageVars.timerRunning to be set into the value.

How would you make the seconds loop and start over at 60. This setup just has it constantly running.

Hi @Wendell_Macklin

I had the same problem and solved it this way:

  1. My seconds are bound to page variable „seconds“

  2. IF(pageVars.seconds==59,true,false)

  3. Mostly it’s false, then one second gets added every second (through the formula: ADD(pageVars.seconds,1) and the „Delay“ node)

  4. When we’re at 59, the page variable gets reseted to 0 and it starts counting again

My minutes are counted separately through the formula (like in the conversation above):

STRING(DATETIME_DIFFERENCE(DATETIME(appVars.timeNow),DATETIME(pageVars.timeStarted), “minutes”))

Hopefully, I could help you.


This is my music timer. It gets refreshed from an app variable “current” that is from a “Get audio info node”.

DIV(appVars.current, 60) + “:” + IF(INTEGER(SUBTRACT(appVars.current, MULTIPLY(DIV(appVars.current, 60), 60)))<10, “0” + INTEGER(SUBTRACT(appVars.current, MULTIPLY(DIV(appVars.current, 60), 60))), INTEGER(SUBTRACT(appVars.current, MULTIPLY(DIV(appVars.current, 60), 60))))

Not sure if it helps but is another way to show time from seconds.

Thanks. That works. I appreciate the help.

I use this
IF((DATETIME_DIFFERENCE(appVars.agora, pageVars.iniciouEm, “seconds”)<60),DATETIME_DIFFERENCE(appVars.agora, pageVars.iniciouEm, “seconds”),DATETIME_DIFFERENCE(appVars.agora, pageVars.iniciouEm, “seconds”)%60)

Fill with left zero
LEFT_PAD(STRING(IF((DATETIME_DIFFERENCE(appVars.agora, pageVars.iniciouEm, “seconds”)<60),DATETIME_DIFFERENCE(appVars.agora, pageVars.iniciouEm, “seconds”),DATETIME_DIFFERENCE(appVars.agora, pageVars.iniciouEm, “seconds”)%60)),2,“0”)