Previous Week Two days Dates

I want to get previous week Monday and Friday Dates while running a bot in present week on any day.
For eg: I want to get previous week Monday 7/02/2022 and Friday 11/02/2022 dates while running a bot in any day of present week.
Please help me out in this problem

Hey @sarvesh.b !! Here is your solution!

Last week Monday:

Datetime.Now.AddDays(-( CInt(Datetime.Now.DayOfWeek) +6))

Last week Friday:

Datetime.Now.AddDays(-( CInt(Datetime.Now.DayOfWeek) +2))

Hope it helps!

Hi,

Can you try the following?

Monday

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

Friday

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

Regards,

Thanks it works…!
Is the result be same if we run on any day of the present week?

Thanks it works!
Is the result be same if we run on any day of the present week?

Hi,

Yes, as the following.

Thanks! I appreciate your solution.

1 Like

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