I need to override the default DayNames of the current (or specified) CurrentCulture object.
I have tried to accomplish this in several ways:
1) At the Global.asax level:
protected void Application_PreRequestHandlerExecute(object sender, EventArgs e) {
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(XXX);
string[] newNames = { YYY };
System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.DayNames = newNames;
}
2) At the Controller level:
public HomeController() {
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(XXX);
string[] newNames = { YYY };
System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.DayNames = newNames;
}
The specified "CurrentCulture" object is applied correctly (according to the specified XXX culture name). I can see a culture-specific day name via the @DateTime.Now.ToString("ddd")
expression.
However, the specified "DayNames" object seems to be ignored (however, I can see that both the "CurrentCulture" and "DayNames" properties are applied correctly in the debugger).