in this post i want to show you how you could create an always up to date timestamp within PowerApps. Just follow the next few steps:
- In the menu bar, click on “Insert” - “Controls” and add a “Timer” to your screen
- Now change the following Timer settings:
- Duration = 0
- AutoStart = true
- Repeat = true
- OnTimerEnd = Set(CurrentDateTime,Now())
Now the timer starts if we start the app, runs and will repeat endless times. Every time the timer ends, it will set the variable “CurrentDateTime” to the current date and time.
To display the current date and time, you need to add a label to your screen and change the text:
- Text =Text(CurrentDateTime,”dddd mm/dd/yyyy hh:mm:ss”)
The current date and time should appear in the label field. If not, please start your app (play button in the upper right corner or F5) or check if your variable “CurrentDateTime” is correct.
If it works fine, you could hide the timer, so that only the label will be visible to your users. Just select the timer on your screen and change the setting:
- Visible = false
Now you have a Timer with the current date and time in PowerApps.
If you want to use different formats, here are some more:
“ddd mm/dd/yyyy hh:mm:ss”
if you want to change the shown language, just add a comma within the Text()-function:
Text(CurrentDateTime,”dddd dd.mm.yyyy hh:mm:ss”,”de-DE”)
Text(CurrentDateTime,”dddd dd.mm.yyyy hh:mm:ss”,”nl-NL”)
Text(CurrentDateTime,”dddd dd.mm.yyyy hh:mm:ss”,”da-DK”)