Previous weeks sunday date

How to store previous weeks sunday date from current date in string variable in below format MM/dd/yyyy

For example we need the previous weeks sunday date : 04/16/2023

@Sathish_Kumar_S

Use Modify date activity to get the previous Sunday

image

I was expecting 16th date as a previous weeks sunday date… but getting 23rd date

Hi,

Can you try the following expression?

 Today.AddDays(-7-CInt(Today.DayOfWeek))

Regards,

As an alternate
grafik

YourDateTimeVar.addDays(-{7,1,2,3,4,5,6}(YourDateTimeVar.DayOfWeek)).toString("MM/dd/yyyy")

in the array you can configure the offset for each day in week (sun=0, mon=1…sat=6)

in case on a Satruday the same day should be used set it from 7 to 0

Hi @Sathish_Kumar_S ,

You can use Modify Date activity to get previous Sunday. By providing input as Now.AddDays(-7) you can get previous weeks Sunday.

image

Output will be in DateTime. You can add a assign activity to convert it to string as shown above.

Hope it helps.

1 Like

grafik

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.