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 / Condition comparing dates
Power Automate
Unanswered

Condition comparing dates

(1) ShareShare
ReportReport
Posted on by 54

I am having an issue with using a date in conditions. My flow needs to compare an Excel date to a SharePoint list date and then update the SP list item if the condition is met. I have tried numerous approaches, but all fail to work properly. If the Excel date is more recent than the SP list date, the item should be updated. Some items are updating even though the dates match. Here is an example of matching dates.

 

 ExcelDate.pngSPdate.png

 

 

I have tried writing the condition with both dates formatted as strings and utcNow as well as the Excel date as a string and utcNow and the SP list date as is. I have tried the condition as less than, greater than, equal to, not equal to. Alas, no matter what I do, items update that should not update. 

Any help would be much appreciated.

Categories:
I have the same question (0)
  • Verified answer
    abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @adr55555 

     

    Try using formatDateTime() expression yyyy-MM-dd format for both Excel and SharePoint dates for comparison.

     

    Thanks

  • adr55555 Profile Picture
    54 on at

    Your suggestion worked, so thank you!

    Why does formatDateTime work but not string or utcNow or ticks? 

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @adr55555 

     

    UTCNow() returns with date with hour, minutes and seconds. To retrieve the date without time, minutes and seconds you need to use the formatDateTime(). 

  • adr55555 Profile Picture
    54 on at

    I actually was in here trying to figure out how to cancel the "accept as solution" when you responded. The solution isn't actually working beyond the small test batch that I initially ran. Despite dates matching, items are still being updated.

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @adr55555

     

    Could you please post a screenshot of your flow and a sample of your Excel data?

     

    Thanks

  • adr55555 Profile Picture
    54 on at

    ExcelData.png

     I added the second EffectiveDate column today. Its full name is EffectiveDate_Use and is formatted as text. The original column is formatted as Short Date.

     

    Flow_Part1.png

    Before I added the second column, I would use ISO 8601 for DateTime Format. Now that I have the EffectiveDate formatted as text, I am leaving that field blank.

     

     

    The next few steps I added so that I can visualize what is happening.

    Flow_Part2.png

     

    Flow_Part3.png

    Flow_Part4.png

     Then I pull the SP List items. The Apply to each 2 action contains: 

    Flow_Part5.png

    For now I have stopped here because the condition continues to return true when it should say false.

     

    Condition is 

    formatDateTime(variables('ExcelEffectiveDate'),'yyyy-MM-dd') is greater than 
    formatDateTime(variables('SPlistEffectiveDate'),'yyyy-MM-dd').
  • adr55555 Profile Picture
    54 on at

    I do finally have this flow working!

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