How to Find most recent fridays of the week?

I am stuck at how to find most recent friday of the week.
Previous Sunday = Today.AddDays(- (Weekday(Today) - 1))
similarly , i am looking for previous friday code. Can anyone help me with this ?

Check this link Return date from previous week

Below expression returns Friday from previous week:

DayOfWeek WeekFriday = DayOfWeek.Friday;
int offsetDays = (int) WeekFriday - (int) DateTime.Now.DayOfWeek;
DateTime lastWeekFriday = DateTime.Now.AddDays(-7 + offsetDays);


DayOfWeek WeekFriday = DayOfWeek.Friday;
DateTime lastWeekFriday = DateTime.Now.AddDays(-7 + ((int) WeekFriday - (int) DateTime.Now.DayOfWeek));



@neetha’s solution is a perfect one if you would like to get the Friday of last week.

In order to get the recent Friday, we need to make an alteration to @neetha’s code.

DayOfWeek WeekFriday = DayOfWeek.Friday;
int offsetDays = cint(WeekFriday) - cint(DateTime.Now.DayOfWeek)
If(offsetDays <=0)
then, DateTime lastWeekFriday = DateTime.Now.AddDays(offsetDays);
Else, DateTime lastWeekFriday = DateTime.Now.AddDays(-7 + offsetDays);

Warm Regards,


Thank you @neetha :innocent:

Thank you so much @nimin for your help !!:handshake:

1 Like

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