How to find Sunday Date for Current Week?

Hi I need help with finding Current Week’s Sunday. For Example today’s date is 11/30/2023
I want sunday’s date to be 12/3/2023

Hi,

How about the following?

DateTime.Now.AddDays(7-DateTime.Now.DayOfWeek).ToString(“M/d/yyyy”)

image

The above returns next Sunday if today is Sunday. If it doesn’t fit for you, the following may be good.

DateTime.Now.AddDays(if(DateTime.Now.DayOfWeek= DayOfWeek.Sunday,0, 7-DateTime.Now.DayOfWeek)).ToString("M/d/yyyy")

Regards,

1 Like

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