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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Text Label in Gallery ...
Power Apps
Unanswered

Text Label in Gallery to display : Time in minutes since Button pressed..

(0) ShareShare
ReportReport
Posted on by 356

Complete amateur here... Trying to find the correct formula for a text label to display the time elapsed in minutes in a gallery since a button is pressed in a form.. my limited knowledge i come up with this....

 

DateDiff(Button1.Pressed,Now(),Minutes)

 

But naturally i get an error.. Can anyone possibly guide me in the right direction..?

 

Thank you!

Categories:
I have the same question (0)
  • zmorek Profile Picture
    3,272 on at

    The problem with this will be that the label in the gallery won't automatically update on its own without it re-evaluating what Now() means. For example, you can test this yourself:

     

    Button OnSelect(): 

    Set(
     varButtonPress,
     TimeValue(Now())
    )

     

    Label Text():

    TimeValue(Now()) - varButtonPress

     

    Select the button, add that into a label, and wait a few minutes. Notice how nothing changes? That's because it'll only evaluate Now() once in that label until you tell it to do so again.

     

    You can get the effect you want by using a timer:

     

    Button OnSelect():

    UpdateContext({TimerStart:!TimerStart})

     

    Timer Start():

    TimerStart

     

    Label Text():

    Text(Timer1.Value,"mm:ss")

     

    Depending on how long you anticipate a user staring at it, you might need to increase the Duration() property of the timer.

  • Lasherza Profile Picture
    356 on at

    Thank You . This appears to be the way to do it!!.  One question... do i need to insert an actual Timer?.or...?

  • Lasherza Profile Picture
    356 on at

    Great i got it!!. I added a timer and just made it not visible!! Thanks so much @zmorek  !! this has worked for me! 😀 👏

  • zmorek Profile Picture
    3,272 on at

    You can hide the timer by setting its Visible() property to false! To my knowledge this is a clean way of accomplishing what you want. Otherwise you'll have to rely on a bunch of OnSelect() statements to set/reset variables and to re-evaluate what "now" is.

  • zmorek Profile Picture
    3,272 on at

    @Lasherza wrote:

    Great i got it!!. I added a timer and just made it not visible!! Thanks so much @zmorek  !! this has worked for me! 😀 👏


    Great - please don't forget to accept as solution so it helps others who come across this down the road.


  • Lasherza Profile Picture
    356 on at

    100% will do right away...not until though please.. I want to reset the timer on the press of another button i have in the form.. Is this similar but add the Reset call?

  • Verified answer
    zmorek Profile Picture
    3,272 on at

    Right you are! You'll have that button's OnSelect() be:

     

    UpdateContext({TimerReset:true})

     

    Also, if you want that button to also start the timer again, use this instead:

    UpdateContext({TimerReset: false});
    UpdateContext({TimerReset: true});
    UpdateContext({TimerStart: false});
    UpdateContext({TimerStart: true})

     

  • Lasherza Profile Picture
    356 on at

    Got it!! Works . Thanks again!!! 🙌

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard