web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Start timer Where it e...
Power Apps
Answered

Start timer Where it ended

(0) ShareShare
ReportReport
Posted on by 22

I am creating a attendance system where a user click on check-in button the timer starts for 10 minutes but if I close my application the timer gets reset which I don't want.....so how to load the previous data of the timer when the app will start

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Dushy 

    As a general design rule with Timers - don't rely on them to keep time!  

    In other words, it is better (when the user clicks the check-in button) to take a snapshot of the current time into a variable. 

    You are not going to get the timer to retain its value if you close the app.  It will reset when the app is opened again.

    BUT, if you need to retain this, then you can take the snapshot of the time Now() and then you would need to save this.  If your app is completely mobile based, you can use the SaveData to store it on the device.  If not, then you will need to store this in a datasource. 

    Once the app is reopened, you can load this value from the device or datasource and then determine what you want to do next.

     

    As a prototype concept for your app...

    1) App starts and gets the time value from storage (device or list).  If it is blank, then assume starting at 0 when the user clicks check-in.  

    2) If the value from above is 0, then allow the user the check-in button. 

        a) User clicks check-in and then Now() is captured and saved to the datasource (device or list).  In the app it is stored in a variable, let's call it glbStartTime - so on the OnSelect of the check-in : Set(glbStartTime, Now())

    3) If the value from above is greater than 0, then you will use that in your calculations to follow and you will store that value in the variable.

     

     

    Now for the timer.

    I would set the timer to a small duration - say 1000 (1 second).  At every second, perform a calculation for the datedif difference of the current time and the stored time -  Set(glbElapsed, DateDiff(Now(), glbStartTime, Seconds))  

    Then you can use the glbElapsed value to determine the amount of seconds since the start time and now.  Based on that you can continue with whatever logic you need.

     

    I hope this is helpful for you.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard