cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dziurgis
Frequent Visitor

Extract wekday date

Hi,

 

How to extract a date of the e.g. last Sunday?

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Dziurgis ,

According to you description, you want to check whether the date fields is in this week based on the current date.

I have made a test on my side, please take a try with the following workaround:

The expression of Compose: sub(0,dayOfWeek(utcNow())), this action is to get the number of the days have passed of this week.

The expression of Compose 2: sub(6,dayOfWeek(utcNow())), this action is to get the number of the days have left of this week.

The first expression of Condition: greaterOrEquals(outputs('Compose_3'),addDays(utcNow(),outputs('Compose')))

The second expression of Condition: lessOrEquals(outputs('Compose_3'),addDays(utcNow(),outputs('Compose_2')))

1.png

Best Regards,

Zhongys

 

View solution in original post

5 REPLIES 5
LeeHarris
Solution Sage
Solution Sage

Hi @Dziurgis

 

Could you please provide more information on what you are trying to achieve? Do you need to compare a date value with another and check the day of the week? Or are you always checking if a given date is the previous Sunday?

Any screen shots of your flow as it is currently stands would also be helpful in assisting you.


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


Follow me on Twitter at @QG_LeeJHarris

Or on LinkedIn at in/leejharris

Hi LeeHarris,

 

I need to implement a requirement to the flow which executes the following actions:

Precondition: There is a list with items. Flow starts after new item created.

Actions:

- Filter existing items of the particular user (the creator of the new item) with statuses "Approved" or "Done"

- Check date fields in each item and if there is an item with the date in this week (can be from Sunday or Monday. It does not matter) execute the condition:

  - if yes -> change status to new created item and send email

  - if no -> start approval process to new item

 

The issue here, that I do not know how to dynamically check if the date belongs to this working week or not.

Hi @Dziurgis

 

If you only want to check previous days in the week based on the current date then you can use the below in a condition.

 

dayOfWeek(triggerBody()['date'])  is less than or equal to  
dayOfWeek(utcNow())
 
Replace triggerBody()['date'] with the date from your new item. The dayOfWeek function will return an integer value for each day with Sunday being 0 and Saturday being 6. 

Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


Follow me on Twitter at @QG_LeeJHarris

Or on LinkedIn at in/leejharris

Hi Dziurgis ,

According to you description, you want to check whether the date fields is in this week based on the current date.

I have made a test on my side, please take a try with the following workaround:

The expression of Compose: sub(0,dayOfWeek(utcNow())), this action is to get the number of the days have passed of this week.

The expression of Compose 2: sub(6,dayOfWeek(utcNow())), this action is to get the number of the days have left of this week.

The first expression of Condition: greaterOrEquals(outputs('Compose_3'),addDays(utcNow(),outputs('Compose')))

The second expression of Condition: lessOrEquals(outputs('Compose_3'),addDays(utcNow(),outputs('Compose_2')))

1.png

Best Regards,

Zhongys

 

View solution in original post

Thank you, v-zhos-msft. This is exactly what I needed.

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.

Top Solution Authors
Users online (3,185)