I tried googling it but nothing came out. My problem i开发者_JS百科s 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]);
}
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
精彩评论