When working with dates in Power Apps data tables, sometimes you must change the date format to suit your application’s requirements or user preferences.
Recently, I was working on the Power Apps data table control where I needed to change a SharePoint date format to dd/mm/yyyy.
In this Power Apps tutorial, I will show you how to change date format in Power Apps data table using two various scenarios:
- Change date format in Power Apps Data table using SharePoint Date column
- Change date format in Power Apps Data table using SharePoint Calculated Date column
How to Change Date Format in Power Apps Data Table
Here, we will see how to change the Power Apps Data table date format using a SharePoint list date column and a SharePoint Calculated date column. Let’s explore one by one.
Change Date Format in Power Apps Data Table using SharePoint Date Field
I have a SharePoint Online list named “Product Details,” which contains different fields, including the Date and time field [Purchase Date].
Note: Whenever a user add "Date and time" column in the SharePoint list, by default the Date format will be "mm/dd/yyyy".
Input:
But, I want to change this SharePoint default date format to “dd/mm/yyyy” in my Power Apps data table control as in the screenshot below.
Output:
You can follow the below steps to achieve it. Such as:
1. On the Power Apps screen -> Insert a Data table and set its Items property as:
Items = 'Product Details'
Where,
- ‘Product Details’ = SharePoint Online List
2. Now, select the Date and time field [Purchase Date] and change its Text property using the code below:
Text = Text(ThisItem.'Purchase Date',"dd/mm/yyyy")
Where,
- ‘Purchase Date’ = SharePoint list date and time field
- “dd/mm/yyyy” = Specify the date format that you want to display in Power Apps Data table
3. This way, you can change the date format in the Power Apps data table. Have a look at the below output.
4. Next, if you want to change the date format to “yyyy/mm/dd,” follow the below code on the Data table Text property:
Text = Text(ThisItem.'Purchase Date',"yyyy/mm/dd")
5. You can also change the date format to “Month day, year” using the code below.
Text = Text(ThisItem.'Purchase Date',"mmm dd,yyyy")
6. Finally, if you want to change the date format and time, follow the code below.
Text = Text(ThisItem.'Purchase Date',"yyyy-mm-ddT:mm:ssZ")
This way, you can change the Power Apps date format using the SharePoint list.
Change date format in Power Apps Data table using SharePoint Calculated Date column
Now, with a simple example, I will show you how to change the SharePoint list calculated date column format in the Power Apps data table.
Example:
I have a SharePoint Online list named “Travel Requests,” and this list has one date and time column [Travel Start Date] and one calculated column named “Travel End Date” [It is created based on the date column].
Input:
Note: Whenever the user adds the SharePoint list calculated date column in the Power Apps data table, it will display the date farmat as always including with the time.
Follow the screenshot below of how the Powe Apps data table gives the SharePoint calculated column data format.
I want to change this date and time format to only the “mm/dd/yyyy” format. Select the calculated column [Travel End Date] and set its Text property to the code below.
Text = Text(DateValue(ThisItem.'Travel End Date'), "mm/dd/yyyy")
Where,
- Travel End Date = SharePoint list calculated column
Once your app is ready, Save, Publish, and Preview the app. The data table formats the calculated date column to “mm/dd/yyyy” as shown below.
I trust this Power Apps tutorial helps. Following the above steps, you can change the date format in a Power Apps data table based on different date formats, like dd/mm/yyyy, yyyy-mm-ddT:mm:ssZ, etc.
Also, you may like some more Power Apps articles:
- Set Alternate Row Color in Power Apps Data Table
- Power Apps Data Table vs Gallery
- Sort Data Table in Power Apps
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com