Click here to Skip to main content
15,890,670 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can i do when i select date from calendar control then on label date should be startdate of week and end date of week
Posted

1 solution

Use the DayOfWeek property of DateTime object.
See http://msdn.microsoft.com/en-us/library/system.datetime.dayofweek.aspx[^]
And read the part of
The value of the constants in the DayOfWeek enumeration ranges from DayOfWeek.Sunday to DayOfWeek.Saturday. If cast to an integer, its value ranges from zero (which indicates DayOfWeek.Sunday) to six (which indicates DayOfWeek.Saturday).

So I can see which value my current DayOfWeek for the CalendarControl is.
Sundayis int 0 so to set begin of week you create a new DateTime().AddDays(x);
x = value 0 - of current DayOfWeek
Well End of week should be simple for you.
 
Share this answer
 

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