web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Unanswered

Format date using SQL

(0) ShareShare
ReportReport
Posted on by 17

I have a PAD flow that executes a SQL statement against an existing Excel spreadsheet and then writes the results to another Excel spreadsheet. The flow itself runs without issue but I've noticed that the column that includes dates is converted from date to datetime when writing back to Excel, e.g., original date = 11/1/2023, write back date = 11/1/2023  12:00:00 AM. I would like to only write the date portion back to the new spreadsheet but haven't figured out what the SQL syntax is to do so, e.g., select trunc(column with date) from ...

 

Below is the SQL query in use. de.ELIGIBILITY_DATE is one example where I want the results to only be date, not datetime.

select
de.FIRST_NAME,
de.LAST_NAME,
de.ELIGIBILITY_DATE,
de.DEFERRED_FILE_AUDIT_DATE,
de.EMPLOYMENT_STATUS,
de.PROJECTED_SERVICE,
de.OPEN_WORKFLOW
from [Original$] de
where de.eligibility_date = #%DeferredDate[0][0]%#

My preference is to do all this in SQL so that I don't have to create a 'for each' loop to convert the date row by row as it's being written. Any suggestions on how I might go about doing this? Thanks!

I have the same question (0)
  • trice602 Profile Picture
    16,105 Super User 2026 Season 1 on at

    Hi @schill27 ,

     

    Here's the formatting to get just the date.  Please mark as a solution if this was helpful!  Always glad to help! Tom

     

    SELECT CONVERT(VARCHAR, de.ELIGIBILITY_DATE, 101) AS FormattedDate FROM your_table_name;
  • schill27 Profile Picture
    17 on at

    Thanks, Tom. Unfortunately, I receive the following error when using CONVERT:

    Correlation Id: 5f299257-5d14-4307-8a16-613fa0c21869

    Undefined function 'convert' in expression.: Microsoft.PowerPlatform.PowerAutomate.Desktop.Actions.SDK.ActionException: Error in SQL statement Undefined function 'convert' in expression. ---> System.Data.OleDb.OleDbException: Undefined function 'convert' in expression.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 636

#2
Valantis Profile Picture

Valantis 372

#3
11manish Profile Picture

11manish 335

Last 30 days Overall leaderboard