Getting current culture day names in .NET

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.


You can use custom cultures to create a new culture based off an existing one. To be honest, though, I'd say that's probably a bit heavy-handed. The "simplest" solution may just be something like:

public string[] GetDayNames()
{
    if (CultureInfo.CurrentCulture.Name.StartsWith("en-"))
    {
        return new [] { "Monday", "Tuesday", "Wednesday", "Thursday",
                        "Friday", "Saturday", "Sunday" };
    }
    else
    {
        return CultureInfo.CurrentCulture.DateTimeFormat.DayNames;
    }
}

Tags:

C#

.Net

Datetime