cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
z123
Level: Powered On

Comparing Days

Hi,

 

I need to compare dates in a rather strange way and I am not having any luck. I've built a test form for this which is just 2 date fields Date 1 and Date 2. 

 

When a user submits the form I need flow to check whether the date 1 and date 2 are within certain parameter. These are:

 

If Date 1 is between Monday to Thursday then Date 2 must be between Monday to Thursday
If Date 1 is Friday then Date 2 must be Friday
If Date 1 is Saturday or Sunday then Date 2 must be Saturday or Sunday

 If these conditions are true then I want an output of True and if they are false I want an output of False. 

 

Any recommendations on the best way to handle this would be great!

 

5 REPLIES 5
Super User
Super User

Re: Comparing Days

@z123 

You can find the day of the week with dayOfWeek() and then use a Switch to set the Date 2.  Does "Date 2" need to be a specific date like "Next Wednesday"? Or do you just need it to be "Wednesday"?

 

-Ed-

 

If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

Super User
Super User

Re: Comparing Days

@z123 

I agree with @edgonzales .  One thing to note is that the dayOfWeek expression returns the day of the week as an integer with Sunday = 0, Monday = 1, etc..

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
z123
Level: Powered On

Re: Comparing Days

Hiya,

 

ah yes, I was using formatdatetime but that would be easier. 

 

I don't need it to be specific date, just the two dates have to be in the same group as such. The user inputs both dates and then it compares them to the specs above.

z123
Level: Powered On

Re: Comparing Days

Ah that's brilliant, I will try that! thank you Smiley Happy 

Highlighted
Community Support Team
Community Support Team

Re: Comparing Days

Hi @z123,

 

Maybe you could have a test on the following expression:Annotation 2019-09-05 162432.png

or(and(and(greaterOrEquals(outputs('Compose_Date_A'), 1),lessOrEquals(outputs('Compose_Date_A'), 4)),and(greaterOrEquals(outputs('Compose_Date_B'), 1),lessOrEquals(outputs('Compose_Date_B'), 4))),and(equals(outputs('Compose_Date_A'), 5),equals(outputs('Compose_Date_B'), 5)),and(or(equals(outputs('Compose_Date_A'), 0),equals(outputs('Compose_Date_A'), 6)),or(equals(outputs('Compose_Date_B'), 0),equals(outputs('Compose_Date_B'), 6))))
I hope it can help you.

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

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 168 members 4,901 guests
Please welcome our newest community members: