One of our client requirement is to show "DD-MMM-YYYY HH:MM:SS" date format in all the date columns in SharePoint List and custom dashboard (built using SPFx). Using custom code logic we implemented the same on the dashboard and using JSON formatting implemented this required format in date column of SharePoint list. But when we export to excel using the custom dashboard or out-of-the-box list the date format automatically converts it to "YYYY-MM-DDTHH:MM:SS", example: 2022-02-10T20:01:00Z. How to ensure consistency, ensuring when exported to excel the date format remains as-is like "DD-MMM-YYYY HH:MM:SS"?
1 Answer
1. Excel export from custom dashboard:
When you export data in excel from custom dashboard, you can use same coding language to pass date fields in required format to excel file.
2. Excel export from SharePoint list:
You cannot customize the SharePoint default functionality to export data in excel file.
Suggested approaches:
- Format the date columns in excel file using excel functionality
- Use Power Automate flow to export list items to excel file. You can format the date columns using
formatDateTime()function in Power Automate.