Return date from previous week

Hello !

How can i return the date of the Wednesday from previous week ?

Thank you !

@Padurariu_Dragos_Vio you can give like this buddy now.adddays(-7).tostring(“dd/MM/yyyy”) it will give the date of wednesday.

1 Like
DayOfWeek desiredDay = DayOfWeek.Wednesday;
int offsetAmount = (int) desiredDay - (int) DateTime.Now.DayOfWeek;
DateTime lastWeekWednesday = DateTime.Now.AddDays(-7 + offsetAmount);
3 Likes

Thank you !!

It works !

1 Like

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