How to Format Dates Safely When Values Are Null or Blank in Power Automate
Question details
The user needs a way to prevent Power Automate flows from failing when attempting to format optional or empty date fields.

- Product
- Power Automate
- Device & OS
- not provided
- Scenario
- Formatting date fields within a Power Automate flow where some dates (such as 'Last Chased') might be optional and left blank.
- Observed behavior
- The flow fails because functions like formatDateTime or parseDateTime cannot process empty or null values.
Verify the exact internal field name of your date columns in your data source, as Power Automate expressions require the exact internal name to evaluate correctly.
Use a Conditional Expression to Check for Empty Values
Wrap your date formatting formula in an 'if' statement to return null when the date field is empty, avoiding execution errors.
When a date field is optional, passing a blank value to the formatDateTime function causes a flow failure. Using the 'empty' function allows you to safely bypass formatting when no data is present in the field.
Open your Power Automate flow and locate the specific action where the date formatting fails due to a null value.
Click inside the input box for the date field and select the 'Expression' tab from the dynamic content menu.
Enter the following conditional expression, replacing 'Last Chased' with your field's internal name: if(empty(items('Apply_to_each')?['Last Chased']), null, formatDateTime(parseDateTime(items('Apply_to_each')?['Last Chased']), 'dd/MM/yyyy', 'en-GB'))
If your data source already outputs a valid ISO 8601 date, you can simplify the expression by omitting parseDateTime: if(empty(items('Apply_to_each')?['Last Chased']), null, formatDateTime(items('Apply_to_each')?['Last Chased'], 'dd/MM/yyyy', 'en-GB'))
Click 'Update' or 'OK' to save the expression, then run a test of your flow to verify that empty dates are now processed without errors.

Looking for a Lightweight Office Alternative?
While Power Automate handles complex automated workflows for Microsoft services, you might be looking for a more streamlined, cost-effective solution for your daily document and spreadsheet tasks. WPS Office offers a free, lightweight, and highly compatible alternative to Microsoft Office.
- 1. Download the software: Visit the official WPS Office website and download the free installer for your operating system.
- 2. Install WPS Office: Run the downloaded setup file and follow the on-screen prompts to complete the installation.
- 3. Open your files: Launch WPS Office and seamlessly open your existing Microsoft Office documents, spreadsheets, and presentations.

Frequently Asked Questions
Why does formatDateTime fail on empty date fields in Power Automate?
The formatDateTime function requires a valid string or timestamp to process. When it receives a null or blank value from an optional field, it throws an error because it cannot parse the empty input.
What is the difference between parseDateTime and formatDateTime?
parseDateTime is used to convert a string representation of a date and time into a standard ISO 8601 timestamp. formatDateTime takes that standard timestamp and converts it into a specified display format, like 'dd/MM/yyyy'.
How do I find the internal name of my SharePoint column for the expression?
Go to your SharePoint list settings, click on the specific column name, and look at the URL in your browser. The text after 'Field=' is the internal name you should use in your Power Automate expression.
Can I use coalescing instead of an 'if' statement for null dates?
Yes, you can use the coalesce() function to provide a default fallback value if the field is null. However, if you want the output to remain explicitly null without applying any formatting, the if(empty(...)) expression is more precise and safer for downstream actions.




