Click here to Skip to main content
15,064,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I want to find the first date of week aswell as the last day of the current week using todays date. From monday to friday
Posted

Try:
C#
DateTime today = DateTime.Now;
DateTime lastSunday = today.AddDays(-(int)today.DayOfWeek);
Note that DayOfWeek runs Sun-Sat, 0 - 6 so you may want to tweak a little if you run Mon-Sun
   
ASP.NET has the answer: Get Current week starting and end date[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900