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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Top Solution Authors
Users online (2,908)