Is there a way to set the first DayOfWeek as Monday = 0 not Sunday?
(int)dateList[0].DayOfWeek == 0) // 0 = Sunday
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You would need to create a custom culture, and specify the initial DayOfWeek as Monday. An instance of your custom culture would need to be set to whatever context is normally used to access culture information (i.e.
Thread.CurrentCulture). The following article should get you started on creating a custom culture:How to: Create Custom Cultures
EDIT:
I just reread your question, and I noticed something. You can not change the DayOfWeek property…that is simply an enumeration value. You would need to compare the DayOfWeek to the FirstDayOfWeek property of the CultureInfo.DateTimeFormat property:
By default,
FirstDayOfWeekisSunday. If you created a custom culture, it could be any day of the week you so choose (i.e.Monday).