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

## Extract wekday date

Hi,

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

1 ACCEPTED SOLUTION

Accepted Solutions
Solution Sage

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')))

Best Regards,

Zhongys

5 REPLIES 5
Solution Sage

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

Frequent Visitor

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.

Solution Sage

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

Solution Sage

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')))

Best Regards,

Zhongys

Frequent Visitor

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

## Helpful resources

Announcements

#### Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

#### Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

#### Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

#### Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (59,115)