Is it possible to get the CurrentCulture's weekdays from DateTimeFormatInfo, but returning Monday as first day of the week instead of Sunday. And, if the current culture isn't English (i.e. the ISO code isn't "en") then leave it as default.
By default CultureInfo.CurrentCulture.DateTimeFormat.DayNames returns:
[0]: "Sunday"
[1]: "Monday"
[2]: "Tuesday"
[3]: "Wednesday"
[4]: "Thursday"
[5]: "Friday"
[6]: "Saturday"
But I need:
[0]: "Monday"
[1]: "Tuesday"
[2]: "Wednesday"
[3]: "Thursday"
[4]: "Friday"
[5]: "Saturday"
[6]: "Sunday"
You can Clone the current culture which gets a writable copy of the CultureInfo object. Then you can set the DateTimeFormat.FirstDayOfWeek to Monday.
CultureInfo current = CultureInfo.Current;
CultureInfo clone = (CultureInfo)current.Clone();
clone.DateTimeFormat.FirstDayOfWeek = DayOfWeek.Monday;
The above clone will now treat Monday as the first day of the week.
EDIT
After re-reading your question I don't think this will do what you're expecting. The DayNames will still return in the same order regardless of the FirstDayOfWeek setting.
But I'll leave this answer up as community wiki in case someone comes across this question in the future.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With