This should be easy, I think, but I coul开发者_运维百科dn't find it (yet) myself.
I need to know if these two values can be retrieved from the system's environment and/or local settings.
I know that in my country (The Netherlands) these values should be:
- FirstDayOfWeek = Monday
- CalendarWeekRule = FirstFullWeek
But I don't want to set a fixed rule for that.
You could retrieve these values from the DateTimeFormat
object.
CultureInfo theNetherlands = CultureInfo.GetCultureInfo("nl-nl");
var firstDayOfWeek = theNetherlands.DateTimeFormat.FirstDayOfWeek;
var calendarWeekRule = theNetherlands.DateTimeFormat.CalendarWeekRule;
If you want to get these values for the current culture you could just use CultureInfo.CurrentCulture.DatetimeFormat
.
精彩评论