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

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

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 (16,261)