coding
coding

Reputation: 167

Data Factory - Getting last Saturday from a current date

How can I find the date of the last Saturday from a current date in ADF (set as a variable) ?

For example in SQL I can run this query and it will return the last Saturday:

enter image description here

but I don't want to create a lookup activity to connect to the database and run that query. I want to define it as a variable.

Is it possible to create a variable that always returns the last Saturday?

Kind regards

Upvotes: 0

Views: 660

Answers (1)

Rakesh Govindula
Rakesh Govindula

Reputation: 11529

You can use below expression to get the last saturday always in set variable activity.

@FormatDateTime(addDays(subtractFromTime(utcnow(),dayOfWeek(utcnow()),'Day'),-1),'yyyy/MM/dd')

Set variable:

enter image description here

Result:

enter image description here

Upvotes: 1

Related Questions