CRM Crate

How to create a clock in Canvas App / Power App?

We will learn to create a clock in Canvas App / Power App. Before we start, make sure to subscribe to CRM Crate so that you can stay up to date in the field of Power Apps.

How to create a clock in Canvas App / Power App?

Steps to create a clock in Canvas App / Power App

Follow the below given procedure for creating a new custom clock in Canvas App.

Step 1 – Insert a Timer Control for creating a clock in Canvas App

create a clock in canvas app
create a clock in canvas app

Step 2 – Set “Duration” property of Timer control

  • Our timer control should display the current value for each fraction of second. Thus we will set the duration of the Timer control to 1 second or 1000 milisecond.
  • Navigate to the “Duration” property and set the value as “1000”.
create a clock in canvas app

Step 3- Configure the Timer to auto-set current time value after restart

  • Since we have configured the Timer’s duration as “1000”, this means that out Timer will end and restart for every 1 second.
  • Therefore, we will set the current DateTime stamp during the end of our Timer.
  • Navigate to the “OnTimerEnd” property of the Timer control and configure it with the below given Power FX formula.
Set(varTimeData, Now())
create a clock in canvas app

Step 4 – Configure the AutoStart & Repeat property

  • Our Timer should automatically start after every fraction of second.
  • Thus, navigate to the “AutoStart” & “Repeat” property and set it to “true” as shown below.

Step 4 – Configure the Clock’s format

  • Microsoft provides multiple DateTimeFormat such as LongTime, LongTime24, ShortTime, ShortTime24, UTC etc.
  • Navigate to the “Text” property of the Timer’s control and configure the time format as per your requirement.
  • In our scenario, we have configured our clock in three different formats as shown below.
Text(varTimeData, DateTimeFormat.ShortTime)
Text(varTimeData, DateTimeFormat.LongTime)
Text(varTimeData, DateTimeFormat.LongDateTime24)

Validate the implementation in Preview / Power Apps Studio

Once the clock is configured, play the Canvas App and validate whether the clock is working as per the implementation.

create a clock in canvas app

Thus, we learned to create a clock in Canvas App / Power App.

5 2 votes
Article Rating
Subscribe
Notify of
3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
binance
4 months ago

Your article helped me a lot, is there any more related content? Thanks!

James
1 month ago

Brilliant, Thank you.

Lumikha ng libreng account
1 month ago

I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.

error: CRM Crate Security Engine - Disabled Right Click & Selection!

Congratulations!

Well Done,
Welcome to CRM Crate

Stay tuned with us and get all latest updates and learning in Microsoft CRM and related techonologes.