Reputation: 442
I tried googling it but nothing came out. My problem is that for EN-GB CultureInfo.CurrentCulture.DateTimeFormat.AbbreviatedDayNames begins with Sun for Sunday when for that culture FirstDayOfWeek is Monday?! I need a way to get AbbreviatedDayNames so that they correspond to FirstDayOfWeek. Otherwise my calendar app for WP7 won't work properly.
UPDATE: This is how I get it now:
DayOfWeek firstDay = CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek;
AbbreviatedDayNames = new List<string>();
for (int i = (int)firstDay; i < 7; i++)
{
AbbreviatedDayNames.Add(CultureInfo.CurrentCulture.DateTimeFormat.AbbreviatedDayNames[i]);
}
for (int i = 0; i < (int)firstDay; i++)
{
AbbreviatedDayNames.Add(CultureInfo.CurrentCulture.DateTimeFormat.AbbreviatedDayNames[i]);
}
Upvotes: 2
Views: 1878
Reputation: 66882
According to MSDN, this property array will always contain the 7 values starting with "Sun":
A one-dimensional array of type String containing the culture-specific abbreviated names of the days of the week. The array for InvariantInfo contains "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", and "Sat".
It looks like this array is indexed using the DayOfWeek enum - http://msdn.microsoft.com/en-us/library/system.dayofweek.aspx
You'll need to build a simple lookup yourself from the current FirstDayOfWeek-indexed week to the fixed abbreviated array
Upvotes: 4