cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gcmorales2000
Microsoft
Microsoft

Date Comparison Issues

I have a sharepoint List  and a flow which compares the date today and the date inside the SP List. however there are logical issues on this formula 

 

formatDateTime(items('Apply_to_each')?['Date'],'MM/dd/yyyy') is greater than or equal to 
formatDateTime(utcnow(),'MM/dd/yyyy')

 

If the Date is 01/02/2020 the condition returns as false (wrong behavior output)

If the Date is 10/16/2019 the condition returns as false (wrong behavior output)

If the Date is 12/07/2019 the condition returns as true (correct behavior)

if the Date is 06/01/2019 the condition returns as false (correct behavior) 

 

Am I missing some statements on my formula?

1 ACCEPTED SOLUTION

Accepted Solutions
v-bacao-msft
Community Support
Community Support

 

Hi @gcmorales2000 ,

 

When comparing Dates in Power Automate, the sizes are compared in order starting from the first number of Date, so we need to unify the format of Date to "yyyy-MM-dd" so that we can compare the sizes accurately.

 

In addition, in SharePoint, if the field format is Date and does not contain time, then its default format is "yyyy-MM-dd". So you only need to format utcNow() into "yyyy-MM-dd".

76.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
RobElliott
Super User
Super User

@gcmorales2000 when you're doing date comparisons, always make sure you use yyyy-MM-dd format.

 

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

v-bacao-msft
Community Support
Community Support

 

Hi @gcmorales2000 ,

 

When comparing Dates in Power Automate, the sizes are compared in order starting from the first number of Date, so we need to unify the format of Date to "yyyy-MM-dd" so that we can compare the sizes accurately.

 

In addition, in SharePoint, if the field format is Date and does not contain time, then its default format is "yyyy-MM-dd". So you only need to format utcNow() into "yyyy-MM-dd".

76.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Users online (2,640)