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 / add day comparison not...
Power Automate
Unanswered

add day comparison not working

(0) ShareShare
ReportReport
Posted on by 155

Hi,

 

I was hoping someone could help me with something, ive been using a condition to compare dates in a list and see if they match now:  this is as below

 

formatDateTime(utcNow(),'yyyy-MM-dd')      is equal to    
formatDateTime(items('For_each')?['Date'],'yyyy-MM-dd')
 
now this works fine but a seperate part of the flow needs to check if the day before was one of these dates and for some reason i cant get it to work
 
formatDateTime(addDays(utcNow(),-1,'yyyy-MM-dd'))    is equal to  
formatDateTime(items('For_each')?['Date'],'yyyy-MM-dd')
 
can anyone see what is wrong with this because i defintely cant

 

Categories:
I have the same question (0)
  • Perumal Profile Picture
    604 on at

    Please try this expression and Let me know if this works for you

    The issue you're encountering is likely due to the incorrect placement of the parameters in the addDays function. The correct usage of addDays should specify the number of days to add or subtract first, followed by the date string, and then format the result. 

     

    Here is the corrected version of your expression:

    formatDateTime(addDays(utcNow(), -1), 'yyyy-MM-dd')

  • TBODEN Profile Picture
    155 on at

    thank you for that but it is still showing as false on the return.  The list has 2024-05-16 being returmned in the output as the day to check for so i cant see where this is going wrong.  especially when it works without the add day modifier

  • Srini007 Profile Picture
    3,467 Super User 2026 Season 1 on at

    Hi @TBODEN 

     

    The expression you tried will be fine, It returns the Yesterday date, month and year. Can you put a compose action and give the date which you are getting the value? the one you are getting inside the For Each

    So, the expression can be CurrentItem of Date, So that you can adjust according to that

     

    If you find this reply helpful, please consider giving it a LIKE AND

    If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION

     

    Cheers,

    Srini

  • TBODEN Profile Picture
    155 on at

    TBODEN_0-1715932771938.png

    ive added the compose, the dates are identical, any idea why it returns as false for is equal to?

     

     

  • Srini007 Profile Picture
    3,467 Super User 2026 Season 1 on at

    Hi @TBODEN 

     

    Can you try hardcode the value and check weather the condition is getting true?

     

    If you find this reply helpful, please consider giving it a LIKE AND

    If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION

     

    Cheers,

    Srini

  • TBODEN Profile Picture
    155 on at

    which value, sorry for being slow

  • Srini007 Profile Picture
    3,467 Super User 2026 Season 1 on at

    Hi @TBODEN 

     

    Maybe the value which is coming from for each try to give a hardcoded value, also can you please share a screenshot of the condition with expanded values?

     

    If you find this reply helpful, please consider giving it a LIKE AND

    If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION

     

    Cheers,

    Srini

     

  • TBODEN Profile Picture
    155 on at

    i think its working now, im not sure why though as nothing has changed from what i can see.  Thanks for the help though

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 594

#2
Valantis Profile Picture

Valantis 469

#3
11manish Profile Picture

11manish 364

Last 30 days Overall leaderboard