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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Automate
Unanswered

Formatting date only

(0) ShareShare
ReportReport
Posted on by

Hi,

 

I have an expiry dat that returns as 2021-01-25T08:00:00Z and I want to compose an email stating what is the expiry date in this format: 25 Jan 2021. I tried using 

 

formatDateTime(triggerBody()?['Expiry Date'],'dd/MM/yyyy')

 

but it doesn't work. it gives me this error 

 

InvalidTemplate. Unable to process template language expressions in action 'Send_an_email_notification_(V3)' inputs at line '1' and column '14342': '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.'.

 

 

Please help me. Thank you in advance

Categories:
I have the same question (0)
  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    Hi @Anonymous 

     

    You need to check that triggerBody()?['Expiry Date'] is actually returning what you expect.

     

    Try it in a compose first.  When you use a ? in an array expression it will return NULL if it cannot be evaluated.  Remove the ? and the expression will fail.  So I guess there is a typo in there somewhere.

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Cheers,
    Damien


    P.S. take a look at my new blog here

  • Verified answer
    VIDIT Profile Picture
    666 on at

    Hi @Anonymous you can do it as shown below

    Put your expire date in a string variable and use that variable in your date formatter

    ViditGholam_0-1617091841717.png

    Output - 

    ViditGholam_1-1617091871089.png

    Hope this helps !

    Let me know in case any issues 

    If this solves your problem please mark this post as answered and hit me a thumps up.

     

    Thanks and Regards,

    Vidit 

  • Community Power Platform Member Profile Picture
    on at

    Hello @ViditGholam !

     

    I am trying to convert to string but I face this issue (in pic). I am unable to put anything under the name portion. 

    Edina_1-1617092735351.png

     

    Able to advice me on how I should do this?

  • Verified answer
    VIDIT Profile Picture
    666 on at

    @Anonymous you will have to initialize a variable some where up in your flow and then set that variable for example look at this flow 

    ViditGholam_0-1617092962098.png

    connectors - 

    ViditGholam_1-1617093000101.png

    it is just like how we define variables in a code and then use or set them as and when needed.

     

  • VIDIT Profile Picture
    666 on at

    also try what @DamoBird365  said even I feel there is a typo in there try removing triggerBody()"?"['Expiry Date']

    "?" from your previous expression.

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    Hi @Anonymous 

     

    I think you are over complicating.  Personally I would strip back the 2nd apply to each and if you are new to Power Automate create the following flow actions:

    DamoBird365_0-1617093178454.png

     

    This would return the following:

    DamoBird365_1-1617093242472.png

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Cheers,
    Damien


    P.S. take a look at my new blog here

     

  • Community Power Platform Member Profile Picture
    on at

    It works! Thank you @ViditGholam 😄

  • Community Power Platform Member Profile Picture
    on at

    Hello @ViditGholam 

     

    Can I check with you regarding another question?

     

    Edina_0-1617097118509.png

    As seen in the picture, the output is 1 and the condition I set is as follows

    Edina_1-1617097308061.png

     

    May I know why is the expression result false?

     

  • VIDIT Profile Picture
    666 on at

    @Anonymous try it out this way 

    ViditGholam_2-1617098416800.png

     

    ViditGholam_1-1617098373281.png

  • Edinaa Profile Picture
    16 on at

    @ViditGholam its the same Edina here. 

     

    I tried 

    string('Due')

    and the output is "Due".

    Edinaa_0-1617157440746.png

    The data in Due is Yes/No or 1/0. How can I write an expression that gets the data instead of the word "Due"?

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard