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 / Expression inside comp...
Power Automate
Answered

Expression inside compose action failed to convert date to MMM-yyyyy

(0) ShareShare
ReportReport
Posted on by 115

Hello. Asking for your help regarding an error to my flow.

 

Background:
I want to convert the dynamic value from Get Items of SharePoint  to convert the Resources Assigned Date to MMM-yyyy (ex. Aug 2024). I am using this expression but failed to format the date:

formatDateTime(items('Apply_to_each')?['Resources Assigned Date'], 'MMM-yyyy')
 
Error:
Unable to process template language expressions in action 'Compose_2' 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'. Please see https://aka.ms/logicexpressions#formatdatetime for usage details.'.
 
Note that there is a data in Resources Assigned Date

Here's my flow:


third_learner_0-1705035891628.png

 

 

The expression is inside the Compose 2 action

third_learner_1-1705035891599.png

 

 

Thank you in advance for your help

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

    Hi @third_learner ,

     

    I recommend you use if in your current expression, please try this:

    if(empty(items('Apply_to_each')?['Resources Assigned Date']),'',formatDateTime(items('Apply_to_each')?['Resources Assigned Date'],'MMM-yyyy'))

     

    Best regards,

    Rimmon

  • third_learner Profile Picture
    115 on at

    @v-mengmli-msft 

     

    The flow did not generate an error based on your expression but the date does not appear when the flow finally send an email See below

     

    third_learner_0-1705037220101.png

     

  • Verified answer
    Manish Solanki Profile Picture
    15,109 Moderator on at

    Hi @third_learner 

     

    Pls try the below expression to handle null values. The below expression will return NA when date is not specified for a list item:

    if(equals(items('Apply_to_each')?['ResourcesAssignedDate'],null),'NA',formatDateTime(items('Apply_to_each')?['ResourcesAssignedDate'], 'MMM-yyyy'))

    If it is giving NA for all list items irrespective of date value in that column then I would suggest you to use internal name of the column in the above expression. 

     

    To get internal name, pls check out my previous solution where I have mentioned the steps to get the internal name of a column or field:

    Solved: Filter Query for Get Items - anything due in 7-14 ... - Power Platform Community (microsoft.com)

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

  • third_learner Profile Picture
    115 on at

    @ManishSolanki A big thank you for helping me. It is now working. Really Appreciate it

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

    Hi @third_learner ,

     

    This is because in current expression, if the current value is null, the expression returns a blank value. If you don't want it to be blank, you can fill in the expression with the value you want.

    vmengmlimsft_0-1705037605460.png

     

  • third_learner Profile Picture
    115 on at

    @v-mengmli-msft Thank you also for helping me.

  • third_learner Profile Picture
    115 on at

    @ManishSolanki A big thank you for helping me. It is now working. Really Appreciate it

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!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 112 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 52

#3
Ellis Karim Profile Picture

Ellis Karim 51 Super User 2026 Season 1

Last 30 days Overall leaderboard