A
C
D
I
R
S
T
What is Power Fx?
Power Fx is a low-code programming language that is used in Power Apps, Power Automate, and Power Virtual Agents. It is a formula-based language that is designed to be easy to learn and use, even for those with little or no coding experience. Power Fx allows you to create complex business logic and automate processes without having to write code from scratch.
The Today Function
The Today function is one of the most commonly used functions in Power Fx. It returns the current date and time in the user’s local time zone. You can use this function to display the current date and time in your app, or to perform calculations based on the current date and time.
Here’s an example of how to use the Today function to display the current date and time in a label:
Text(Today(), “dd/mm/yyyy hh:mm:ss”)
This formula uses the Text function to format the output of the Today function as a string in the format "dd/mm/yyyy hh:mm:ss". You can customize the format of the output by changing the format string.
Using the Today Function in Power Apps
To use the Today function in Power Apps, follow these steps:
1. Open your app in the Power Apps Studio.
2. Navigate to the screen where you want to use the Today function.
3. Add a new label to the screen.
4. Set the Text property of the label to the Today function, formatted as desired.
Here's an example of how to use the Today function to display the current date and time in a label in Power Apps:
1. Open your app in the Power Apps Studio.
2. Navigate to the screen where you want to use the Today function.
3. Add a new label to the screen.
4. Set the Text property of the label to the following formula:
Text(Today(), “dd/mm/yyyy hh:mm:ss”)
5. Save and publish your app.
Customizing the Today Function
You can customize the output of the Today function by changing the format string used by the Text function. Here are some examples of different format strings:
- "dd/mm/yyyy" - Displays the date in the format day/month/year.
- "hh:mm:ss" - Displays the time in the format hours:minutes:seconds.
- "dddd" - Displays the day of the week (e.g. "Monday", "Tuesday", etc.).
- "mmm" - Displays the month abbreviation (e.g. "Jan", "Feb", etc.).
You can combine these format strings to create custom formats that suit your needs. For example, the following formula displays the date and time in the format "dd/mm/yyyy hh:mm:ss":
Text(Today(), “dd/mm/yyyy”) & ” ” & Text(Now(), “hh:mm:ss”)
The Power Fx Today function is a powerful tool that makes it easy to display the current date and time in your Power App. By using the Text function to format the output of the Today function, you can customize the display of the date and time to meet your specific needs. With these tips, you can start using the Today function and take your Power App to the next level.