Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

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

(0) ShareShare
ReportReport
Posted on by 909 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?

  • Ry009_ Profile Picture
    109 on at
    Re: 'The template language function 'formatDateTime' expects its first parameter to be of type string.

    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?

     

  • Verified answer
    v-yetonggu-msft Profile Picture
    on at
    Re: 'The template language function 'formatDateTime' expects its first parameter to be of type string.

    Hi @wonka1234 ,

    This information is enough, please try this expression:

     

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

     

    Best Regards,

    Sunshine Gu

  • wonka1234 Profile Picture
    909 Super User 2024 Season 1 on at
    Re: 'The template language function 'formatDateTime' expects its first parameter to be of type string.

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

     

    wonka1234_0-1702952763267.png

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

  • v-yetonggu-msft Profile Picture
    on at
    Re: 'The template language function 'formatDateTime' expects its first parameter to be of type string.

    Hi @wonka1234 ,

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

     

    Best Regards,

    Sunshine Gu

  • wonka1234 Profile Picture
    909 Super User 2024 Season 1 on at
    Re: 'The template language function 'formatDateTime' expects its first parameter to be of type string.

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

     

    wonka1234_0-1702951216658.png

    wonka1234_1-1702951291129.png

     

  • v-yetonggu-msft Profile Picture
    on at
    Re: 'The template language function 'formatDateTime' expects its first parameter to be of type string.

    Hi @wonka1234 ï¼Œ

    Please show a complete screenshot of your flow.

    Best Regards,

    Sunshine Gu

  • wonka1234 Profile Picture
    909 Super User 2024 Season 1 on at
    Re: 'The template language function 'formatDateTime' expects its first parameter to be of type string.

    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
    on at
    Re: 'The template language function 'formatDateTime' expects its first parameter to be of type string.

    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

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492