How to get current date in Power Apps?

Working with dates and times, such as formatting dates according to time zone, is currently the most difficult challenge for Power Apps developers. In this Power Apps tutorial, we will discuss how to get current date in Power Apps.

To get the current date, we are going to use the different types of date and time functions such as Now(), Today(), etc.

Recently, I was working on a canvas app in Power Apps, where we need to display the current date.

To meet this requirement, the following steps are:

Get current date using Power Apps Today()

Under the Power Apps Date and time function, there is a function named Today(). That returns the current date.

The syntax for this function is:

Today()

Let’s build a blank canvas app and use this function to get the current date in Power Apps.

  • Sign in the PowerApps with your Microsoft credential.
  • Go to Create > Blank App > Canvas App.
  • Give a name to the canvas app > Create.

Now the canvas app is ready. To display the current date within the Power Apps screen, add a Label control to the screen. Go to Insert > Input > Text label.

Insert the below expression on the label’s text property to display the current date.

Text = Today()
Get current date in Power Apps
Get current date in Power Apps

The above Power Apps screen is displaying the current date i.e., 2/7/2023. This is how to get the current date on the Power Apps screen.

Get the current date using Power Apps Now()

There is another function named Now() under the Power Apps date and time function that is used to return the current date with time.

The syntax for this function is:

Now()

Let’s use this function inside the Power Apps screen to display the current date with the time. To implement this, we are going to use the above Power Apps canvas app.

  • Add a label control to the Power Apps screen.
  • Insert the below expression on the label’s text property.
Text = Now()
Get the current date with time in Power Apps
Get the current date with time in Power Apps

The above Power Apps screen is displaying the current date with the time i.e., 2/7/2023 1:18 PM. This is how to get the current date with the time within the Power Apps.

Get the current date using Power Apps date picker control

Along with the data label control, we can use the Power Apps date picker control to get the current date.

By default, while using a Power Apps date picker control, it will display the current date as per the date time zone such as local or UTC.

Let’s use the Power Apps date picker control to display the current date, and the following steps are:

  • On the above Power Apps screen, add a Date and time picker control. Go to Insert > Input > Date picker control.
  • Once we add the date picker control to the screen, it will display the current date as default.
Get current date in PowerApps
Get the current date in PowerApps
  • On the above screen, it is displaying the current date based on the time zone i.e., Local. But, it allows setting the time zone to UTC format.
  • Once we set the time zone to UTC, the current date will display in the UTC format as below. Select the above date picker control > DateTimeZone > UTC.
Getting the current date in Power Apps
Getting the current date in Power Apps

This is how to get the current date in Power Apps Date picker control.

Read How to filter SharePoint choice field within Power Apps?

How to check the current date in Power Apps?

Here, we will see whether the selected or inserted date is the current date or not in Power Apps. There is another function named IsToday() that determines whether a date/time value is between 12:00 a.m. today and 12:00 a.m. tomorrow. This function returns a Boolean value (true or false).

To work with this Power Apps function, we are going to use the above date picker control and the following steps are:

  • On the above Power Apps screen, add a text label control and place it beside the date picker control.
  • Insert the below expression on the label’s text property to check whether the selected date is the current date or not.
Text = IsToday(DatePicker1.SelectedDate)

Whether DatePicker1 is the name of the Power Apps date picker control.

Check current date in Power Apps
Check the current date in Power Apps

As the selected date i.e., 2/7/2023 is the current date, it is displaying the result as true. Similarly, if you select another date, then it will display the result as False as below:

Check current date in PowerApps
Check the current date in PowerApps

This is how to check the current date in Power Apps.

Conclusion

From this Power Apps tutorial, we learned how to get current date within the Power Apps using different functions and control. Such as:

  • How to get the current date using Power Apps Today() function?
  • How to get the current date and time using Power Apps Now() function?
  • How to get the current date using the Power Apps date picker control?
  • How to check the current date within the Power Apps?

You may like the following Power Apps tutorials:

>