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 Platform Community / Forums / Power Automate / 'The template language...
Power Automate
Answered

'The template language function 'formatDateTime' expects its first parameter to be of type string.

(0) ShareShare
ReportReport
Posted on by 920 Super User 2024 Season 1

Hi,

 

I am trying - formatDateTime(item()?['ConclusionDate'],'mm/dd/yyyy')

 

But getting error - 

Unable to process template language expressions in action 'Send_an_email_(V2)' inputs at line '0' and column '0': 'The template language function 'formatDateTime' expects its first parameter to be of type string. The provided value is of type 'Null'

 

where am I going wrong?

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

    Hi @wonka1234 ,

    Because there is a null value in your 'ConclusionDate' column, flow will report an error.

    Please try this expression:

     

    if(empty(item()?['ConclusionDate']),null,formatDateTime(item()?['ConclusionDate'],'mm/dd/yyyy'))

     

    Best Regards,

    Sunshine Gu

  • wonka1234 Profile Picture
    920 Super User 2024 Season 1 on at

    Thanks @v-yetonggu-msft  . No error now, but now the body of the email is showing blank lol.

    But I see in update item :

    wonka1234_0-1702950868826.png

     

     

    But no value is showing with your expression in the email body.

  • v-yetonggu-msft Profile Picture
    Microsoft Employee on at

    Hi @wonka1234 ,

    Please show a complete screenshot of your flow.

    Best Regards,

    Sunshine Gu

  • wonka1234 Profile Picture
    920 Super User 2024 Season 1 on at

    @v-yetonggu-msft  Not sure if this helps..

     

    wonka1234_0-1702951216658.png

    wonka1234_1-1702951291129.png

     

  • v-yetonggu-msft Profile Picture
    Microsoft Employee on at

    Hi @wonka1234 ,

    It’s useless. What are the steps before your flow?

     

    Best Regards,

    Sunshine Gu

  • wonka1234 Profile Picture
    920 Super User 2024 Season 1 on at

    @v-yetonggu-msft  nothign much related to ConclusionDate happens.

     

    wonka1234_0-1702952763267.png

    Date is related to the other date field in the email.

  • Verified answer
    v-yetonggu-msft Profile Picture
    Microsoft Employee on at

    Hi @wonka1234 ,

    This information is enough, please try this expression:

     

    formatDateTime(body('Update_item')?['ConclusionDate'],'MM/dd/yyyy')

     

    Best Regards,

    Sunshine Gu

  • Ry009_ Profile Picture
    109 on at

    Hi

    I tried a modifed version of your suggestion, but it's returning nulls, not sure what I'm doing wrong?

     

     

    if(empty(item()?['_Table[Datefield]']),null,formatDateTime(item()?['_Table[Datefield]'],'dd/MM/yyyy'))

     


    This is my flow with the expression in the compose step;

    Ry009__0-1719376030370.png

     

    Not sure what I'm doing wrong?

     

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 248 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 204

#3
Haque Profile Picture

Haque 179

Last 30 days Overall leaderboard