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 / Time/Date field expres...
Power Automate
Answered

Time/Date field expression not working

(0) ShareShare
ReportReport
Posted on by 144

Hello and thanks in advance.

 

I'm setting up a flow that sends an email. In that email, I need to format the time better than what it comes out today as:

Shap1_0-1631567163943.png

 

 

I was able to successfully get this to work before but trying the same expression (formatDateTime(triggerOutputs()?['body/hc_startdate'], 'MM/dd/yyyy')) and still getting an error:

 

Shap1_1-1631567253192.png

 

Is my syntax incorrect?

 

Categories:
  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @Shap1  can you check if the value of triggerOutputs()?['body/hc_startdate'] is no value or blank?  from error it looks like there is no value for hc_startdate

  • Shap1 Profile Picture
    144 on at

    Hi @Ann- Thanks for your reply.

     

    I put in the existing normal field and it populates. I'm just trying to convert that to a better date field using an expression. It looks like my expression is not working even though hc_startdate by itself works.

     

    Shap1_0-1631625801660.png

     

  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @Shap1  can you add compose action with this expression triggerOutputs()?['body/hc_startdate'] just to see if it has value or not

  • VJR Profile Picture
    7,635 on at

    Hello @Shap1 

     

    Could you please share your formatDateTime expression.

    And as requested by Anna check out the Compose action.

     

  • Shap1 Profile Picture
    144 on at

    @VJR @annajhaveri 

    Thanks guys. Here's is my compose:

     

    Shap1_0-1631719155243.png

     

     

    Also, this is my expression: 

    formatDateTime(triggerOutputs()?['body/hc_startdate'], 'MM/dd/yyyy')

     

  • nc1 Profile Picture
    28 on at

    .

  • Shap1 Profile Picture
    144 on at

    Thanks @nc1.

     

    I tried as you suggested: replace(formatDateTime(triggerOutputs()?['body/hc_startdate'],'MM-dd-yyyy'),'-','/')

     

    This did not work and came back as the following:

    "The template language function 'formatDateTime' expects its first parameter to be of type string. The provided value is of type 'Null'."

    Shap1_0-1631746130184.png

     

  • VJR Profile Picture
    7,635 on at

    Hi @Shap1 

     

    It doesn't seem to be right that the Compose statement is not printing the actual value of the hc_startdate.

    Can you double check why? Is there a value in it? Have you selected it correctly from the Dynamic content.

    If that is blank then the error is right about the Null value.

     

     

     

     

  • nc1 Profile Picture
    28 on at

    It is something with your current date/time variable. I would cast it as a string to be sure it's the correct format and then ensure that you are selecting the correct dynamic content.

     

    I misread prior to my first comment oops.

    nc

     

    Edit:

    https://powerusers.microsoft.com/t5/Building-Flows/Flow-failing-due-to-Null-value/td-p/55527

    take a peek at this solution, it may be of help.

  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @Shap1  you need to put the expression in the Dynamic content -> Expressions, not as a text in compose action. Can you please try putting expression via Dynamic content -> Expressions? and see the value of compose action in flow run?

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

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 377

#2
11manish Profile Picture

11manish 292 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 128

Last 30 days Overall leaderboard