cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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
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.

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
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (40,393)