Power Automate allows users to work with dates and times in various formats, but sometimes an incorrect format can cause flow failures.
A date formatting issue may result in errors such as:
“Date formatting issue – Incorrect date format being used in an expression.”
This error typically occurs when:
- An incorrect format is used in a function.
- A date string is not in a recognized format.
- An incompatible date format is passed to an action.
- The system expects a different locale (e.g., MM/DD/YYYY vs. DD/MM/YYYY).
2. Common Causes of Date Formatting Issues
Cause | Description | Example |
---|---|---|
Incorrect Date Format in Expression | A function expects a specific format but receives an unrecognized one. | formatDateTime('2025-12-31', 'MM/dd/yyyy') |
Incompatible Date Format in API Calls | Some APIs expect ISO 8601 format (yyyy-MM-ddTHH:mm:ssZ ). | 01-12-2025 instead of 2025-12-01T00:00:00Z |
Locale Differences | Some regions use MM/DD/YYYY while others use DD/MM/YYYY . | 13/01/2025 (UK) vs. 01/13/2025 (US) |
Date Stored as Text | A date is stored as text instead of a proper DateTime format. | "12-31-2025" instead of 2025-12-31T00:00:00Z |
Missing or Incorrect Timezone Handling | Some services require UTC, and incorrect handling can cause errors. | "2025-12-31 10:00" (local) vs. "2025-12-31T10:00:00Z" (UTC) |
3. Step-by-Step Troubleshooting Guide
Step 1: Identify Where the Issue Occurs
- Go to Power Automate (https://flow.microsoft.com).
- Open My Flows and find the flow with the error.
- Click Run History and locate the failed execution.
- Expand the failed action and check the error message.
Example Error Message:
"The provided value '12-31-2025' is not a valid DateTime format."
Step 2: Use formatDateTime()
to Ensure Proper Formatting
Power Automate provides the formatDateTime()
function to convert dates into the desired format.
Solution: Use formatDateTime()
to format the date properly.
Example Fix:
Format Required | Correct Expression |
---|---|
MM/dd/yyyy (US) | formatDateTime(variables('date'), 'MM/dd/yyyy') |
dd/MM/yyyy (UK) | formatDateTime(variables('date'), 'dd/MM/yyyy') |
yyyy-MM-ddTHH:mm:ssZ (ISO 8601) | formatDateTime(variables('date'), 'yyyy-MM-ddTHH:mm:ssZ') |
Incorrect:
formatDateTime('12-31-2025', 'MM/dd/yyyy')
Correct:
formatDateTime('2025-12-31', 'MM/dd/yyyy')
The date must be in a recognized format before applying formatDateTime()
.
Step 3: Convert Text to a Date Format
If a date is stored as text, convert it into a date object first.
Solution: Use convertToUtc()
or parseDateTime()
to ensure it is a valid date.
Example Fix:
Incorrect (text value not recognized as date):
formatDateTime('12-31-2025', 'yyyy-MM-dd')
Correct:
formatDateTime(convertToUtc('12-31-2025', 'Eastern Standard Time'), 'yyyy-MM-dd')
Step 4: Adjust for Regional Date Formatting Issues
Sometimes Power Automate misinterprets dates due to different regional formats (e.g., 01/12/2025
as January 12 instead of December 1).
Solution: Use convertTimeZone()
to standardize formats.
Example Fix:
Incorrect (Assuming DD/MM/YYYY but Power Automate reads as MM/DD/YYYY):
formatDateTime('01/12/2025', 'yyyy-MM-dd')
Correct (Converting properly based on locale):
convertTimeZone('01/12/2025', 'GMT Standard Time', 'UTC', 'yyyy-MM-dd')
Always specify the correct format when working with different locales.
Step 5: Ensure APIs Receive ISO 8601 Format
Some APIs require the ISO 8601 date format:
Solution: Convert the date to yyyy-MM-ddTHH:mm:ssZ
.
Example Fix:
Incorrect (API rejecting MM/DD/YYYY
):
formatDateTime('12/31/2025', 'MM/dd/yyyy')
Correct (API expects ISO 8601):
formatDateTime(utcNow(), 'yyyy-MM-ddTHH:mm:ssZ')
This ensures API compatibility.
Step 6: Handle Timezone Differences Properly
If a date does not include timezone information, Power Automate might misinterpret it.
Solution: Use convertTimeZone()
to ensure proper timezone handling.
Example Fix:
Incorrect (assuming local time but needs UTC):
formatDateTime('2025-12-31 10:00', 'yyyy-MM-ddTHH:mm:ss')
Correct (converting to UTC):
convertTimeZone('2025-12-31 10:00', 'Eastern Standard Time', 'UTC', 'yyyy-MM-ddTHH:mm:ssZ')
Always use UTC when integrating with APIs or databases.
Step 7: Test the Fixed Expression in Power Automate
Before running the flow, test the expression:
- Open the Expression Builder.
- Copy the expression and paste it into a new Compose action.
- Click Test to check the output.
If the output is incorrect, modify the expression based on the troubleshooting steps above.