cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Olivier
Level 8

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
Community Support Team
Community Support Team

Re: Realtime Date Time display in Text Box

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

4 REPLIES 4
Community Support Team
Community Support Team

Re: Realtime Date Time display in Text Box

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

Olivier
Level 8

Re: Realtime Date Time display in Text Box

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.

Olivier
Level 8

Re: Realtime Date Time display in Text Box

Hi again Mabel,

 

It works!

Thanks,

 

Olivier

Olivier
Level 8

Re: Realtime Date Time display in Text Box

Hi again Mabel,

 

 

It works, thanks.

Olivier

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,994)