1
Answer

CultureInfo.DateTimeFormat.FirstDayOfWeek not changing results for CultureInfo.Calendar.GetDayOfWeek(DateTime);

David Malinowski

David Malinowski

13y
9.2k
1

I need to create a billing scheme where to pay week goes Friday to Thursday.  
CultureInfo
cult = new CultureInfo("en-US",true);

Calendar FIMCal;
cult.DateTimeFormat.FirstDayOfWeek = DayOfWeek.Friday;
cult.DateTimeFormat.CalendarWeekRule =
CalendarWeekRule.FirstFullWeek;

FIMCal = cult.Calendar;

int result = (int)FIMCal.GetDayOfWeek(DateTime.Now);
The variable "result" is assigned 1 for Monday when it should be 3. Friday should be 0 Thurday 6 and so on.
Why is the Cultureinfo not changing the DayofWeek enum???
Answers (1)