cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Belasor
Helper III
Helper III

dayOfWeek not working

Hi all,

 

I build a Flow where I check if the current day is a weekday. I do this with following code

 

dayOfWeek(body('Add_to_time_CurrentDay'))

 

 

However the value which I compose with dayOfWeek is returning me the number. I´m passing the value to a condition and check if the value is not equal to 6=Saturday or 0=Sunday.

 

Unfortunately every value is true, so the final result also include the weekend days.2020_07_24_11_21_39_adminrds_Remote_Desktop_Connection.png

1 ACCEPTED SOLUTION

Accepted Solutions
v-litu-msft
Community Support
Community Support

Hi @Belasor,

 

The issue is caused by the logic in Condition action not correct.

No matter which day of the week, it will return to the true.

If the day of the week is 1-5, it will meet two conditions and return true;

If the day of the week is 0, it will meet the second condition and return true;

If the day of the week is 6, it will meet the first condition and return true.

 

So if you want to determine the day of the week whether is weekend, please change the condition to And:

Annotation 2020-07-27 103806.jpg

 

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.

View solution in original post

5 REPLIES 5
ChristianAbata
Super User
Super User

please @Belasor  try adding and expresion string with the numbers, instead the numbers in your condition. see

 

ifstring.PNG



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA

Unfortunately this is also not working with the same result.

v-litu-msft
Community Support
Community Support

Hi @Belasor,

 

The issue is caused by the logic in Condition action not correct.

No matter which day of the week, it will return to the true.

If the day of the week is 1-5, it will meet two conditions and return true;

If the day of the week is 0, it will meet the second condition and return true;

If the day of the week is 6, it will meet the first condition and return true.

 

So if you want to determine the day of the week whether is weekend, please change the condition to And:

Annotation 2020-07-27 103806.jpg

 

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.

View solution in original post

Thank you for the answer. Unfortunately also this is not working

error2.pngError.png

Hi @Belasor,

 

Please not use the string() function convert integer 6 and 0 to string "6" and "0", cause the return of dayOfWeek() function is an integer, different types couldn't compare:

Annotation 2020-07-27 153642.jpg

 

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
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!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (1,940)