Now

How to Use the Power Fx Now  Function in Power Apps

What is the Now Function?

The Now function is a powerful tool that enables you to display the current date and time in your apps. You can use it to show the date and time a record was created or modified, display a countdown timer, or simply add a timestamp to your data.

Here is the syntax for the Now function:


Now()


You can use this function in any formula that requires the current date and time.

How to Use the Now Function

Using the Now function in Power Apps is very simple. Here’s how to do it:

1. Open the app that you want to add the Now function to.

2. Select the control that you want to add the function to.

3. In the formula bar, type the Now function followed by the format that you want to use. For example, if you want to display the current date and time in the format "dd/mm/yyyy hh:mm:ss", your formula should look like this:


Now(“dd/mm/yyyy hh:mm:ss”)


4. Press Enter to save the formula.

That’s it! The control should now display the current date and time in the format that you specified.

Formatting the Now Function

The Now function allows you to format the date and time in a variety of ways. Here are some of the most commonly used formats:

- **"dd/mm/yyyy"**: Displays the date in the format day/month/year.

- **"hh:mm:ss"**: Displays the time in the format hours:minutes:seconds.

- **"dd/mm/yyyy hh:mm:ss"**: Displays the date and time in the format day/month/year hours:minutes:seconds.

- **"dddd, mmmm dd, yyyy hh:mm:ss"**: Displays the date and time in the format day-of-week, month-name day, year hours:minutes:seconds.

You can also use other characters in your format string to customize the output. For example, you can use "/" or "-" to separate the parts of the date, or use "." or ":" to separate the parts of the time.

Using the Now Function in Calculated Columns

The Now function is not just limited to controls in your app. You can also use it in calculated columns in your data source. This can be useful if you want to automatically populate a column with the current date and time.

Here’s how to use the Now function in a calculated column:

1. Open the data source that you want to add the calculated column to.

2. Click the "Add column" button.

3. In the "Name" field, give the column a name.

4. In the "Formula" field, type the Now function followed by the format that you want to use. For example:


Now(“dd/mm/yyyy hh:mm:ss”)


5. Click the "Create" button to save the column.

The calculated column should now be added to your data source, and will automatically update with the current date and time whenever a new record is created.

The Now function is a powerful tool that can help you to display the current date and time in your Power Apps. By using the format string, you can customize the output to suit your needs. Whether you are adding timestamps to your data, displaying countdown timers, or simply showing when a record was created or modified, the Now function is an essential part of your Power Fx toolkit.

Power Apps Training Courses by G Com Solutions (0800 998 9248)