Do you need to get the value of a timer control to use in your Power Apps? Perhaps you want to keep track of how long it’s taking your users to fill out a form for example. In this post, I’ll show how you can put that timer value into a more user friendly format.

Default Timer Control Behavior

When you’re using a timer control, the timer output is stored in milliseconds like you see here:

Figure 1: Default output of the timer control

It probably isn’t ideal to have that value stored in this format. Typically you would want to see this in Hours, Minutes and Seconds format. Like we see here:

Figure 2 – Timer Output in Hours Minutes Seconds Format

Outputting in Hours, Minutes, Seconds Format

To get the Timers Value outputted in this format, you can use the following Formula:

With(
    {
        seconds: RoundUp(Timer1.Value/1000,1)
    },
    With(
        {
            minutes: RoundDown(seconds / 60,0),
            secondsRemaining: Mod(
                seconds,
                60
            )
        },
        With(
            {hours: RoundDown(minutes / 60,0)},
            hours & " hour(s) " & minutes & " minute(s) " & secondsRemaining & " second(s)"
        )
    )
)

This uses the new(ish) With() function in Power Apps to help do some math. First, you need to get the number of seconds in the timer which you can do using the RoundUp function and passing in the Timers value. You will take that calculation to then get the minutes and you’ll take the minutes to get the hours.

If you’d prefer a video walk through of this check out my YouTube Video:

The post Power Apps Timer Output Formatting appeared first on April Dunnam – SharePoint Siren.

Previous articlePower App Mutli Screen Form Controls
Next articlePower Apps Timer Value to Hours, Minutes, Seconds
avatar
I'm a Partner Technical Architect at Microsoft and Power Apps/Power Automate MVP Alumni. As a Partner Technical Architect on the Modern Workplace Team, I focus on helping our partner ecosystem skill-up on Teams and Power Platform and overcome technical barriers. I'm a developer who is passionate about the Power Platform. I have an active YouTube Channel and blog where I share how-to videos and demos around Power Apps, Power Automate, Teams and SharePoint. I regularly speak at events across the globe to share Power Platform knowledge. On top of blogging, I speak at local tech events and run the local PowerApps and Flow User Group. When I’m not working I love going to karaoke or trivia night at the local brewery.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.