Get the Previous Sunday Date from Current date and previous Monday date from current date

Hey Hi,

I want to enter previous sunday date from current date into the system.

please someone help me on the same.

Hi @nvignesh456

Please try below expression

YourDateTimeVar.AddDays(7 -YourDateTimeVar.DayOfWeek - 7)

Date.Now.AddDays(7 - Date.Now.DayOfWeek - 7)

Hi @nvignesh456 ,
You can use the below logic for the same

DateTime.Now.AddDays(7 - Convert.ToInt16(DateTime.Now.DayOfWeek) - 7)

1 Like

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