In this post, we will learn how to show internet base time in powerapps canvas app.
We can get the local time of the user by using the function Now(), that will return the user device time and if the user change his device time the return value of the Now() function will change also to this value.
What if we have some requirements to display a time in a canvas app based on Internet Time or Server Time., to avoid changing the time in Canvas app every time the user change their time?
Show internet base time in PowerApps API
To Show internet base time in PowerApps canvas app we will create custom connector and connect to some API sites that provide the global time.
In this video we discuss how to Create custom connector from blank to connect to the World Time API: Simple JSON/plain-text API to obtain the current time in, and related data about, a timezone.
PowerApps custom connectors can be configured to allow the use of APIs that aren’t covered by the public connectors.
PowerApps custom connectors provide a way to extend apps by calling APIs, services, and systems for scenarios tailored toward your business needs.
Steps to Show internet base time in PowerApps
- Open Power Apps make site in the custom connector
- Create Custom connector from blank
- Provide a name for your connector
- Choose http schema and in the host write the base URL worldtimeapi.org
- In Authentication type, keep it No Authentication
- Write the Operation ID for example in my example I named it GetcairoTime
- In the definition click import from sample ,choose the get verb and type your API with your country time zone as shown below
You can check the time zones that provide by the API from here
- Add default response
- and type the JSON code for your time zone in the body section and click import
- Create the custom connector and test it.
- Open your PowerApps Canvas app and add your custom connector
- Insert a label to show the response of your connector and write the following formula
DateTimeValue to get only the date and time from the response of the custom connector
- Nested Collection In PowerApps :3 Level
- Tabbed Form In PowerApps
- PowerApps Variables Types : Context Variable Vs Global Variable Vs Collections
- Canvas App Collections
- How To Overcome PowerApps Delegation Limit?
- How To Use PowerApps Value Function?
- How To Use Power Automate?
- PowerApps Print Function, Forms, And Scrollable Galleries
- PowerApps Validation Examples On/before Submitting
- Share PowerApps With External Users / Guest Users
- Subscribe to Power Platform Geeks YouTube channel.
- Register to Saudi Arabia Power Platform User Group.
- Have a related question? Please ask it at deBUG.to Community.