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
Answered

@formatDateTime

(0) ShareShare
ReportReport
Posted on by 10

Hello,

I have problem with @formatDateTime forumala in compose action. I need to format date  to supported flow format.

 

I tried these variants:

"@formatDateTime(‘custom_date_column’, 'o')"

"@formatDateTime(‘custom_date_column’)"

"@formatDateTime(concat(formatDateTime(‘custom_date_column’​​,'yyyy-MM-ddThh:mm:ss'),'-3:00'),'d/MM/yyyy hh:mm tt')"

"@formatDateTime(‘custom_date_column’,'yyyy-MM-dd hh:mm:ss')"

 

And in all variants, I receive error

 'In function 'formatDateTime', the value provided for date time string (‘custom_date_column’ was not valid. The datetime string must match ISO 8601 format.'.

 

Maybe someone have ideas how to format date column from SharePoint Online list?

Categories:
I have the same question (0)
  • Verified answer
    v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @Mumbrasas,

     

    Simply input the column name with the FormatDateTime function from SharePoint online list would not work here.

    As the function is used under Microsoft Flow, we should use the Triggers/Actions and the related part from the them to identify the corresponding columns.

    For example, here we take use of the When a New Item is created as the Flow trigger, then we need to use the EndTime value from the SharePoint list, we should write the formula under Compose Action as below:

    "@formatdatetime(triggerBody()?['EndTime'],'yyyy-MM-ddThh:mm:ss')"

    Mostly this is not so easy for end users to handle, so I would share a little tricks to find the content part:

    1. Add a Compose Action after the trigger/Action, then specify the Compose input with the following format:

    "@formatdatetime( ,'yyyy-MM-ddThh:mm:ss')"

    2. Click at the first parameter part of the formatdatetime, then choose the corresponding dynamic content, save it,

    3. Microsoft Flow won't save successfully, and would notify the error message of validation failed,which then we may find the corresponding part for the input,

    4. Copy and paste the corresponding data within the braces @{ } into the function first parameter, then save the flow

    Adding screenshots as reference:

    68.PNG

    69.PNG

    70.PNG

    Hope this helps,

    Regards

  • Mumbrasas Profile Picture
    10 on at

    It's working. Thank you verry much.

  • dmarin Profile Picture
    64 on at

    This works for me, however I am only able to use it once. 

     

    I have a start and end date on my list, where I add 2 separate "Compose" actions, it ignores the second one. 

     

    How can I have both working ?

  • bstaples Profile Picture
    15 on at

    Not sure if this is your issue, but i renamed my Compose titles to be 'First Day' and 'Last Day' and they then both showed up as individual outputs for selection.

     

    Untitled.png 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I cannot get this to work in my flow, i am trying to convert a US date format into an Australian date format with no success using the above fix. Any advice would be greatly appreciated.

     

    Keeps emailing me like this, the bold part is my column name in my SharePoint list.

     

    Start date: @{formatdatetime(@{triggerBody()?['Leave_x0020_start_x0020_date']},'dd/MM/yyyy')}

  • bstaples Profile Picture
    15 on at

    As per the instructions above, i think your problem is you need to remove the @{} symbols.  I think you'll find you need your function to look something like this.

     

    "@formatdatetime(triggerBody()?['Leave_x0020_start_x0020_date'],'dd/MM/yyyy')"

     

    I actually ended up using @addhours so that i could manipulate for DLS.   My code is below

     

    "@addHours(triggerBody()?['Start_x0020_Date'],11,'dd/MM/yyyy-HH:mm')"

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Is there a trigger to make all outputs in formatdatetime in EST? 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks ill give that a try and let you know the outcome.

  • gunjan Profile Picture
    82 on at

    My Condition 

    if(greater(length(actionOutputs('DueDate')),0),formatDateTime(outputs('DueDate'),'yyyy-MM-dd'),''), works perfectly for valid date value, but for empty value it is no working.
    The condition above mentioned getting fail if the value is empty 
     
    if(equals(empty(actionOutputs('DueDate')),false),formatDateTime(outputs('DueDate'),'yyyy-MM-dd'),''), is also generating the error :
    In function 'formatdatetime', the value provided for date time string '' was not valid. The datetime string must match ISO 8601 format.'.
    which hould not be the case for False condition.
    Please suggect the solution.I am applying substring method to get the date.
  • gunjan Profile Picture
    82 on at

    My Condition 

    if(greater(length(actionOutputs('DueDate')),0),formatDateTime(outputs('DueDate'),'yyyy-MM-dd'),''), works perfectly for valid date value, but for empty value it is no working.
    The condition above mentioned getting fail if the value is empty 
     
    if(equals(empty(actionOutputs('DueDate')),false),formatDateTime(outputs('DueDate'),'yyyy-MM-dd'),''), is also generating the error :
    In function 'formatdatetime', the value provided for date time string '' was not valid. The datetime string must match ISO 8601 format.'.
    which should not be the case for False condition.
    Please suggect the solution.I am applying substring method to get the date.
    Need to pass the null / empty string value to the date.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 267 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 196

#3
Haque Profile Picture

Haque 182

Last 30 days Overall leaderboard