Getting current culture day names in .NET
Posted
by cxfx
on Stack Overflow
See other posts from Stack Overflow
or by cxfx
Published on 2010-05-25T00:13:01Z
Indexed on
2010/05/25
0:21 UTC
Read the original article
Hit count: 701
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"
© Stack Overflow or respective owner