cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Olivier
Kudo Collector
Kudo Collector

Realtime Date Time display in Text Box

It is probably obvious, but I haven't found the simplest way to continuously update Date and Time in a Text Box.

ThisItem.Text=Now()  Is static and doesn't refresh (which I think is normal)

Using a timer and setting the Text property of a Text Box to Timer.Value works, the Text Box gets updated,  I tried using a timer with the OnTimerEnd Event, but didn't find a way to use it to update the Text Property of a Text Box.

The only idea I have is not very satisfying: use a concatenation of the Now() result and Timer.Value for the seconds, which is a bad hack.

Thanks for the help.

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-yamao-msft
Community Support
Community Support

Hi Olivier,

 

About this issue, using a Timer control would be a good choice. I added a TextBox control and a Timer control in my App.
>About Timer control, I set its AutoStart and Repeat property to True, Duration property to 60000, OnTimeEnd property to UpdateContext({textbox1:Text(Now(),"dd/mm/yy hh:mm:ss")}).
>About TextBox control, I set its Text property to textbox1.

 

This works well for me, when the Timer ends, the Date and Time would be refreshed in the TextBox control. As a workaround, please try if this works for you.

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-yamao-msft
Community Support
Community Support

Hi Olivier,

 

About this issue, using a Timer control would be a good choice. I added a TextBox control and a Timer control in my App.
>About Timer control, I set its AutoStart and Repeat property to True, Duration property to 60000, OnTimeEnd property to UpdateContext({textbox1:Text(Now(),"dd/mm/yy hh:mm:ss")}).
>About TextBox control, I set its Text property to textbox1.

 

This works well for me, when the Timer ends, the Date and Time would be refreshed in the TextBox control. As a workaround, please try if this works for you.

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you Mabel,

I didn't try it yet, but I am sure it works!  I didn't know you could use UpdateContext() on a control's property, so thanks for that.

I will use this every second rather than every minute just so the time difference between actual time and displayed time is a max of one second.

Hi again Mabel,

 

It works!

Thanks,

 

Olivier

Hi again Mabel,

 

 

It works, thanks.

Olivier

How to create realtime date and time on power apps that always repeat at 00.00 everyday?
it isn't only for calculating the display time but to show Now() in realtime ticking seconds...

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,470)