logo
search
Others

How to Format Dates Safely When Values Are Null or Blank in Power Automate

Emma BrownEmma Brown Oct 20, 2026 869 views

Question details

The user needs a way to prevent Power Automate flows from failing when attempting to format optional or empty date fields.

How to Format Dates Safely When Values Are Null or Blank in Power Automate
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.
Before you start

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.

Solution 1Recommended

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.

1
Locate the failing step

Open your Power Automate flow and locate the specific action where the date formatting fails due to a null value.

2
Open the Expression Editor

Click inside the input box for the date field and select the 'Expression' tab from the dynamic content menu.

3
Enter the conditional formula

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'))

4
Simplify for ISO dates

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'))

5
Save and Test

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.

Use a Conditional Expression to Check for Empty Values
Internal Field Names: Make sure to replace 'Last Chased' in the expression with the actual internal name of your field from the data source, not just the display name.
Free Microsoft Office alternative

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. 1. Download the software: Visit the official WPS Office website and download the free installer for your operating system.
  2. 2. Install WPS Office: Run the downloaded setup file and follow the on-screen prompts to complete the installation.
  3. 3. Open your files: Launch WPS Office and seamlessly open your existing Microsoft Office documents, spreadsheets, and presentations.
Easily manage, clean, and format date columns in spreadsheets before importing them into your automated workflows.Fully compatible with Microsoft Excel (.xlsx), Word (.docx), and PowerPoint (.pptx) formats.Lightweight software that runs smoothly on Windows, Mac, Linux, and mobile devices.Intuitive tabbed interface that feels instantly familiar, ensuring a seamless migration.
microsoft office alternative - wps office

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.