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 Platform Community / Forums / Power Automate / Expression: Add Hours ...
Power Automate
Unanswered

Expression: Add Hours within a FormatDateTime expression

(0) ShareShare
ReportReport
Posted on by 243

Hi all,

 

Needing some advice regarding an expression for a date field. 

 

An expression used in a flow to populate an invoice date field (field a), with a date from another record (field b) is populating the day prior to what is expected for 'field b'.  I believe it is one day prior, as our time zone is 10 hours ahead of the UTC time zone - so when populating 'now' I would generally write as ... ... ...  addhours(utcNow(), 10) .  This makes me think that the 'field a' & 'field b' situations means that I need to apply this addhours function to the expression that I'm writing.

The expression I've used which is populating the 'field a' is:

formatDateTime(body('Get_Field_b_Date_for_Invoice')?['ec_date'], 'yyyy-MM-dd')

 

When I tried to add the 10 hours in there, I keep getting an Invalid Expression.  Updated invalid expression:

formatDateTime(addhours(body('Get_Field_b_Date_for_Invoice')?['ec_date'], '10')'yyyy-MM-dd')

 

Any feedback is appreciated.

T.

Categories:
I have the same question (0)
  • CFernandes Profile Picture
    8,402 Most Valuable Professional on at

    @Tarjani Let me try to simple for you.

     

    If you are not comfortable with expression, the just use the 'Add to Time', see screenshot below.

     

    CFernandes_0-1600159282803.png 

     

    You also the Function ference at https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#addtotime 

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

     

  • Tarjani Profile Picture
    243 on at

    @CFernandes ,

    I appreciate your feedback, but I think you are simplifying the wrong expression - or I am missing what you are trying to say.  

     

    I'm fine with doing an addhours expression.  However I"m trying to insert this expression, inside another expression.  The expression that I'm trying to put it into is the one that I need to work with.  If possible, I'd like to do it with an expression as the expression that I listed in my original post is being used within a variable.

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 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard