How to Convert String to Date in Power Automate

```html

How to Convert String to Date in Power Automate

Working with dates is one of the most common requirements in Power Automate. Data received from SharePoint, Excel, Forms, Dataverse, APIs, CSV files, and external systems is often stored as text instead of a proper date value.

Before performing calculations, filtering records, sorting data, or updating date fields, the text value must be converted into a valid date format.

Power Automate provides several expressions and functions that make date conversion simple and efficient.


Why Convert String to Date?

Many systems return dates as strings.

Examples:

2025-07-15
15/07/2025
07-15-2025
2025-07-15T10:30:00Z

Although these values look like dates, Power Automate may treat them as plain text.

Converting them properly allows:

Power Automate commonly uses ISO 8601 date formats when processing dates.


Understanding Date Formats

Common formats include:

MM/dd/yyyy

07/15/2025

dd/MM/yyyy

15/07/2025

yyyy-MM-dd

2025-07-15

yyyy-MM-ddTHH:mm:ssZ

2025-07-15T10:30:00Z

The ISO 8601 format is the most reliable format for Power Automate processing.


Method 1: Using formatDateTime()

The most commonly used function is:

formatDateTime()

Syntax:

formatDateTime(DateValue,'yyyy-MM-dd')

Example:

formatDateTime(
'2025-07-15T10:30:00Z',
'dd/MM/yyyy'
)

Output:

15/07/2025

The formatDateTime() function formats date values into the desired output pattern.


Method 2: Convert String from SharePoint

Suppose SharePoint returns:

2025-07-15

Expression:

formatDateTime(
triggerBody()?['DueDate'],
'MM/dd/yyyy'
)

Output:

07/15/2025

This is useful when displaying dates in emails and reports.


Method 3: Convert Excel Date Strings

Excel imports often contain:

15/07/2025

Power Automate may not recognize this format directly.

Convert it into ISO format:

2025-07-15

Then use:

formatDateTime(
variables('ConvertedDate'),
'yyyy-MM-dd'
)

Non-ISO formats frequently require transformation before formatting.


Method 4: Using Compose Action

Add a Compose action and use:

formatDateTime(
utcNow(),
'dd/MM/yyyy'
)

Output:

15/07/2025

Compose actions make date transformations easier to test and debug.


Method 5: Converting Date and Time

Input:

2025-07-15T14:30:00Z

Expression:

formatDateTime(
triggerBody()?['Created'],
'dd/MM/yyyy HH:mm'
)

Output:

15/07/2025 14:30

Power Automate supports extensive custom date formatting patterns.


Common Date Formats

Day Month Year

formatDateTime(
utcNow(),
'dd/MM/yyyy'
)

Output:

15/07/2025

Month Day Year

formatDateTime(
utcNow(),
'MM/dd/yyyy'
)

Output:

07/15/2025

ISO Format

formatDateTime(
utcNow(),
'yyyy-MM-dd'
)

Output:

2025-07-15

Full Date

formatDateTime(
utcNow(),
'dddd, MMMM dd, yyyy'
)

Output:

Tuesday, July 15, 2025

Real-World Example

Employee Onboarding Process

CSV Input:

15/07/2025

Power Automate Flow:

Read CSV
↓
Convert String
↓
Format Date
↓
Create Record

Output:

2025-07-15

Dataverse receives a valid date value.


Working with Dataverse Date Fields

Dataverse expects proper date values.

Example:

formatDateTime(
variables('StartDate'),
'yyyy-MM-dd'
)

Use this value when updating:


Time Zone Conversion

Convert UTC to local time:

convertTimeZone(
utcNow(),
'UTC',
'Eastern Standard Time',
'dd/MM/yyyy HH:mm'
)

Output:

15/07/2025 09:30

Power Automate includes dedicated time-zone conversion functions.


Common Errors

Invalid Date Format

Error:

The datetime string must match ISO 8601 format

Cause:

15/07/2025

Power Automate may not recognize this format directly.

Null Values

Handle safely using:

formatDateTime(
coalesce(
triggerBody()?['Date'],
utcNow()
),
'yyyy-MM-dd'
)

This prevents runtime failures.


Best Practices


Benefits


Common Use Cases


Conclusion

Converting strings to dates is a common requirement in Power Automate. By using functions such as formatDateTime(), Compose actions, and time-zone conversion expressions, organizations can transform text values into valid date formats, improve data quality, and build more reliable automation processes.

Whether you are working with SharePoint, Dataverse, Excel, APIs, or external systems, mastering date conversion techniques will make your Power Automate solutions more accurate and easier to maintain.

```