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 / How to compare Date va...
Power Automate
Answered

How to compare Date value get item ?

(0) ShareShare
ReportReport
Posted on by 2

Hello everyone!

I’m encountering an issue comparing two dates in Power Automate’s Get items action. I have two variables to work with, each handling dates in different ways:

  1. Variable 1: This converts a date from a SharePoint list item (Date of Expired) into the format yyyy-MM-dd. If the value is blank, it defaults to 2000-01-01.

    if(empty(item()?['Date of Expired']), '2000-01-01', formatDateTime(item()?['Date of Expired'], 'yyyy-MM-dd'))
    
  2. Variable 2: This formats the current UTC date (utcNow()) into yyyy-MM-dd.
    formatDateTime(utcNow(), 'yyyy-MM-dd')
    

The issue arises when I try to compare these two variables in a filter query within Get items. I keep receiving an error message.

Does anyone know the correct way to format this query for a successful date comparison in Power Automate? Any help would be appreciated!

 
Categories:
I have the same question (0)
  • Suggested answer
    Daniel Bocklandt Profile Picture
    5,099 Super User 2025 Season 2 on at
    Hey I think I can spot the issue. 
     
    You see the filter Querry works as following: 
    Column name gt Value
    So to use this correctly you would need to do this: 
    (Date_x0020_of_x0020_Expired ne null) and (Date_x0020_of_x0020_Expired gt formatDateTime(utcNow(), 'yyyy-MM-dd'))
    Be aware that you cannot format the Sharepoint column in this experssion that means, that you have to format UTCNow() so that it matches whatever sharepoint gives you. 
     
    If this solvede your porblem please accept it as solution so others can find it as well. 
    If it helped in any other way consider liking it so we can keep supporting eachother. 

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

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard